Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-07-30 20:35:21 +0400
committerJunio C Hamano <junkio@cox.net>2006-07-31 01:23:00 +0400
commitf59aac47f3839367d0da04019b0fc2bd61345225 (patch)
treec60498c9bb8288133e219a1b6112235ed71fe7b9 /merge-recursive.c
parenta060b803b49c04cd6e3b0d859f131349dab6b26f (diff)
merge-recur: fix thinko in unique_path()
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>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 6a796f24c7..5375a1ba30 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -477,9 +477,9 @@ static char *unique_path(const char *path, const char *branch)
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)