diff options
author | Junio C Hamano <junkio@cox.net> | 2006-08-08 12:21:33 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-08-08 12:47:55 -0700 |
commit | 329a304714255f6e5528b4311d29f9d83c85d201 (patch) | |
tree | 22c27e9f7ada2b9bcd80a3d53b80ad152c5a1ea0 /builtin-mv.c | |
parent | aa5481c1af08edbca821a0d025d26e9bc41a5c49 (diff) | |
download | git-329a304714255f6e5528b4311d29f9d83c85d201.tar.gz git-329a304714255f6e5528b4311d29f9d83c85d201.tar.xz |
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>
Diffstat (limited to 'builtin-mv.c')
-rw-r--r-- | builtin-mv.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |