git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] config: don't segfault when given --path with a missing value

From
Jeff King <peff@peff.net>
Date
Nov 15, 2012, 18:15 UTC
Message-ID
<20121115181527.GA22506@sigill.intra.peff.net>
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:
Show 12 quoted lines
> 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
Previous: Carlos Martín Nieto
Message 6 of 6 in “config: don't segfault when given --path with a missing value”
  1. config: don't segfault when given --path with a missing valueCarlos Martín Nieto, Nov 14, 2012
  2. Jeff KingNov 15, 2012
  3. Jeff KingNov 15, 2012
  4. Jeff KingNov 15, 2012
  5. config: don't segfault when given --path with a missing valueCarlos Martín Nieto, Nov 15, 2012
  6. Jeff KingNov 15, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.