From: Eric Sunshine <sunshine@sunshineco.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Tanay Abhra <tanayabh@gmail.com>, Git List <git@vger.kernel.org>,
Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: [PATCH] pretty.c: make git_pretty_formats_config return -1 on git_config_string failure
Date: Mon, 4 Aug 2014 14:56:03 -0400 [thread overview]
Message-ID: <CAPig+cRo05mG9yeU61VSjAvXWRHU9soaaH-Cv7MKoxZ=it15Rw@mail.gmail.com> (raw)
In-Reply-To: <vpqmwbki7h3.fsf@anie.imag.fr>
On Mon, Aug 4, 2014 at 11:45 AM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> 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
This probably should be formalized as a proper test and included with
Tanay's patch.
>> diff --git a/pretty.c b/pretty.c
>> index 3a1da6f..72dbf55 100644
>> --- a/pretty.c
>> +++ b/pretty.c
>> @@ -65,7 +65,9 @@ static int git_pretty_formats_config(const char *var, const char *value, void *c
>>
>> commit_format->name = xstrdup(name);
>> commit_format->format = CMIT_FMT_USERFORMAT;
>> - git_config_string(&fmt, var, value);
>> + if (git_config_string(&fmt, var, value))
>> + return -1;
>> +
>
> Ack-ed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
>
> My first thought reading this was "why not rewrite using non-callback
> API?", but this particular call to git_config needs to iterate over
> config keys anyway.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2014-08-04 18:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 14:41 [PATCH] pretty.c: make git_pretty_formats_config return -1 on git_config_string failure Tanay Abhra
2014-08-04 15:45 ` Matthieu Moy
2014-08-04 18:56 ` Eric Sunshine [this message]
2014-08-04 19:49 ` Matthieu Moy
2014-08-04 20:33 ` Jeff King
2014-08-04 21:06 ` Matthieu Moy
2014-08-04 21:56 ` [PATCH] config: teach "git -c" to recognize an empty string Jeff King
2014-08-04 22:25 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPig+cRo05mG9yeU61VSjAvXWRHU9soaaH-Cv7MKoxZ=it15Rw@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=tanayabh@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).