mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
argv created by handle_alias should be NULL terminated
Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
dd4c59121f
commit
d5b9e6cfa7
11
git.c
11
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;
|
||||
|
|
Loading…
Reference in a new issue