1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-28 20:56:09 +02:00

builtin-mv: fix use of uninitialized memory.

Juergen Ruehle noticed that add_slash() tries to strcat()
into uninitialized memory and fails.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-08-08 12:21:33 -07:00
parent aa5481c1af
commit 329a304714

View File

@ -48,7 +48,8 @@ static const char *add_slash(const char *path)
if (path[len - 1] != '/') {
char *with_slash = xmalloc(len + 2);
memcpy(with_slash, path, len);
strcat(with_slash + len, "/");
with_slash[len++] = '/';
with_slash[len] = 0;
return with_slash;
}
return path;