From: Jeff King <peff@peff.net>
To: "Carlos Martín Nieto" <cmn@elego.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] config: don't segfault when given --path with a missing value
Date: Thu, 15 Nov 2012 10:15:28 -0800 [thread overview]
Message-ID: <20121115181527.GA22506@sigill.intra.peff.net> (raw)
In-Reply-To: <1353003001-22600-1-git-send-email-cmn@elego.de>
On Thu, Nov 15, 2012 at 10:10:01AM -0800, Carlos Martín Nieto wrote:
> When given a variable without a value, such as '[section] var' and
> asking git-config to treat it as a path, git_config_pathname returns
> an error and doesn't modify its output parameter. show_config assumes
> that the call is always successful and sets a variable to indicate
> that vptr should be freed. In case of an error however, trying to do
> this will cause the program to be killed, as it's pointing to memory
> in the stack.
>
> Detect the error and return immediately to avoid freeing or accessing
> the uninitialed memory in the stack.
>
> Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Acked-by: Jeff King <peff@peff.net>
> Yeah, that's more sensible. I didn't notice that the buffer never gets
> written to in this codepath, and the trying to print it out is silly
> when we know that there is nothing valid to print.
> Thanks for the review. I've included your test as well, which really
> makes all of this your code.
Eh, I guess so. You did the hard part of finding it, though. ;)
> Do we have some equivalent of a Basically-writen-by line?
Nothing structured. But I am comfortable enough with the number of times
I am mentioned in "git log" already, so don't worry about it.
-Peff
prev parent reply other threads:[~2012-11-15 18:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-14 4:50 [PATCH] config: don't segfault when given --path with a missing value Carlos Martín Nieto
2012-11-15 16:08 ` Jeff King
2012-11-15 16:11 ` Jeff King
2012-11-15 16:18 ` Jeff King
2012-11-15 18:10 ` Carlos Martín Nieto
2012-11-15 18:15 ` Jeff King [this message]
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=20121115181527.GA22506@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=cmn@elego.de \
--cc=git@vger.kernel.org \
/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).