projects
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa5481c
)
builtin-mv: fix use of uninitialized memory.
author
Junio C Hamano
<junkio@cox.net>
Tue, 8 Aug 2006 19:21:33 +0000
(12:21 -0700)
committer
Junio C Hamano
<junkio@cox.net>
Tue, 8 Aug 2006 19:47:55 +0000
(12:47 -0700)
Juergen Ruehle noticed that add_slash() tries to strcat()
into uninitialized memory and fails.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-mv.c
patch
|
blob
|
history
diff --git
a/builtin-mv.c
b/builtin-mv.c
index e47942c13522b2bc8a83203c61071697c9a03307..ce8187c1e96833e1a6db2fa368a84b02fec7b0c2 100644
(file)
--- 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;