Re: [PATCH] config_set_multivar(): disallow newlines in keys
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 22, 2007, 15:21 UTC
- Message-ID
- <Pine.LNX.4.63.0701221619110.22628@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <81b0412b0701220706w65ed0657h1d69819e7879ed40@mail.gmail.com>
Hi,
On Mon, 22 Jan 2007, Alex Riesen wrote:
Show 12 quoted lines
> On 1/20/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > --- a/config.c
> > +++ b/config.c
> > @@ -661,6 +661,11 @@ int git_config_set_multivar(const char* key, const
> > char* value,
> > goto out_free;
> > }
> > c = tolower(c);
> > + } else if (c == '\n') {
> > + fprintf(stderr, "invalid key (newline): %s\n", key);
>
> BTW, why config.c never uses error() or warn()?Mainly because error() was meant to be used as "return error("blabla");", and we tried to discern different failures by different return values.
But yeah, I think it would be acceptable to use error() instead of fprintf() even then.
BTW IMHO we will probably never libify git; too many too complicated cases exist already.
Ciao, Dscho