From: Junio C Hamano Date: Tue, 8 Aug 2006 19:21:33 +0000 (-0700) Subject: builtin-mv: fix use of uninitialized memory. X-Git-Tag: v1.4.2-rc4~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=329a304714255f6e5528b4311d29f9d83c85d201;p=git.git 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 --- diff --git a/builtin-mv.c b/builtin-mv.c index e47942c13..ce8187c1e 100644 --- a/builtin-mv.c +++ b/builtin-mv.c @@ -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;