author | Jeff King <peff@peff.net> | |
Fri, 8 May 2009 09:06:15 +0000 (05:06 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 9 May 2009 08:39:40 +0000 (01:39 -0700) | ||
commit | 27d5438d9f4eb2cefc2a989c68f9b42b529b2a12 | |
tree | 10f41e0160a28b93dcdc6814fc4a3e2fe0eb9fbb | tree | snapshot |
parent | 2c5b0115038ab283b346fbb8059b93973ff4c8f2 | commit | diff |
fix GIT_TRACE segfault with shell-quoted aliases
The alias argv comes from the split_cmdline function, which
splits the config text for the alias into an array of
strings. It returns the number of elements in the array, but
does not actually put a NULL at the end of the array.
Later, the trace function tries to print this argv and
assumes that it has the trailing NULL.
The split_cmdline function is probably at fault, since argv
lists almost always end with a NULL signal. This patch adds
one, in addition to the returned count; this doesn't hurt
the other callers at all, since they were presumably using
the count already (and will never look at the NULL).
While we're there and using ALLOC_GROW, let's clean up the
other manual grow.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The alias argv comes from the split_cmdline function, which
splits the config text for the alias into an array of
strings. It returns the number of elements in the array, but
does not actually put a NULL at the end of the array.
Later, the trace function tries to print this argv and
assumes that it has the trailing NULL.
The split_cmdline function is probably at fault, since argv
lists almost always end with a NULL signal. This patch adds
one, in addition to the returned count; this doesn't hurt
the other callers at all, since they were presumably using
the count already (and will never look at the NULL).
While we're there and using ALLOC_GROW, let's clean up the
other manual grow.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
alias.c | diff | blob | history |