Browse Source

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>
maint
Junio C Hamano 19 years ago
parent
commit
329a304714
  1. 3
      builtin-mv.c

3
builtin-mv.c

@ -48,7 +48,8 @@ static const char *add_slash(const char *path) @@ -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;

Loading…
Cancel
Save