Re: [PATCH] setup_revisions(): do not access outside argv
- From
Thomas Jarosch <thomas.jarosch@intra2net.com>
- Date
- May 21, 2009, 18:02 UTC
- Message-ID
- <4A159720.3020103@intra2net.com>
- In-Reply-To
- <20090521041812.GE8091@sigill.intra.peff.net>
Jeff King wrote:
Show 5 quoted lines
> Having just fixed a segfault in the GIT_TRACE code caused by a > non-terminated argv generated by the alias code, I think I would prefer > that we just consistently do the NULL-termination. You are otherwise > creating a maintenance pitfall when somebody later passes the value to > unsuspecting code.
Speaking of that, there is also one piece of code in diff.c that doesn't do NULL-termination after a readlink() call (which never NULL-terminates). The current use is 100% fine, though the same maintenance argument might apply here, too. Wondering why the buffer is allocated as PATH_MAX +1. Hmm.
Thomas