From: Matthias Lederhofer Date: Fri, 14 Jul 2006 16:37:06 +0000 (+0200) Subject: argv created by handle_alias should be NULL terminated X-Git-Tag: v1.4.2-rc1~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d5b9e6cfa7a20932ca17649c9172619c9d961db4;p=git.git argv created by handle_alias should be NULL terminated Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- diff --git a/git.c b/git.c index 102735af6..ee5a0e86a 100644 --- a/git.c +++ b/git.c @@ -133,13 +133,12 @@ static int handle_alias(int *argcp, const char ***argv) fflush(stderr); } + new_argv = realloc(new_argv, sizeof(char*) * + (count + *argcp + 1)); /* insert after command name */ - if (*argcp > 1) { - new_argv = realloc(new_argv, sizeof(char*) * - (count + *argcp)); - memcpy(new_argv + count, *argv + 1, - sizeof(char*) * *argcp); - } + memcpy(new_argv + count, *argv + 1, + sizeof(char*) * *argcp); + new_argv[count+*argcp] = NULL; *argv = new_argv; *argcp += count - 1;