Skip to content

Commit

Permalink
argv created by handle_alias should be NULL terminated
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Matthias Lederhofer authored and Junio C Hamano committed Jul 14, 2006
1 parent dd4c591 commit d5b9e6c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d5b9e6c

Please sign in to comment.