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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>

Acked-by: Jeff King <peff@xxxxxxxx>

> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]