Re: [PATCH] pretty.c: make git_pretty_formats_config return -1 on git_config_string failure
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Aug 4, 2014, 21:06 UTC
- Message-ID
- <vpqtx5s7yo4.fsf@anie.imag.fr>
- In-Reply-To
- <20140804203351.GA12898@peff.net>
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
> On Mon, Aug 04, 2014 at 05:45:44PM +0200, Matthieu Moy wrote: > >> Tanay Abhra <tanayabh@gmail.com> writes: >> >> > `git_pretty_formats_config()` continues without checking git_config_string's >> > return value which can lead to a SEGFAULT. >> >> Indeed, without the patch: >> >> $ git -c pretty.my= log --pretty=my >> error: Missing value for 'pretty.my' >> zsh: segmentation fault git -c pretty.my= log --pretty=my > > Hmm. Not related to the original patch, but that really looks like a > bug. Shouldn't "git -c pretty.my= ..." set pretty.my to the empty string? > > I'd expect "git -c pretty.my ..." to set it to NULL (i.e., the "implicit > true" you get from omitting the "=" in the config files themselves).
Indeed.
strbuf_split_buf() does not seem to distinguish between x= and x. No time to debug this further, sorry.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/