summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a060b80)
raw | patch | inline | side by side (parent: a060b80)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Sun, 30 Jul 2006 16:35:21 +0000 (18:35 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 30 Jul 2006 21:23:00 +0000 (14:23 -0700) |
This could result in a nasty infinite loop, or in bogus names (it used
the strlen() of the newly allocated buffer instead of the original
buffer).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
the strlen() of the newly allocated buffer instead of the original
buffer).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
merge-recursive.c | patch | blob | history |
diff --git a/merge-recursive.c b/merge-recursive.c
index 6a796f24c7f3cdba2c6c2dc1c93bdfcd0c5c2ea1..5375a1ba307e866f23900d9088f06e21ae5c997d 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
char *newpath = xmalloc(strlen(path) + 1 + strlen(branch) + 8 + 1);
int suffix = 0;
struct stat st;
- char *p = newpath + strlen(newpath);
+ char *p = newpath + strlen(path);
strcpy(newpath, path);
- strcat(newpath, "~");
+ *(p++) = '~';
strcpy(p, branch);
for (; *p; ++p)
if ('/' == *p)