{"thread":{"id":"5043","subject":"[PATCH] merge-recur: fix thinko in unique_path()","startedAt":"2006-07-30T16:35:21Z","lastAt":"2006-07-30T16:35:21Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"24377","messageId":"Pine.LNX.4.63.0607301835020.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5043","inReplyTo":null,"subject":"[PATCH] merge-recur: fix thinko in unique_path()","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-30T16:35:21Z","receivedAt":"2006-07-30T16:35:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis could result in a nasty infinite loop, or in bogus names (it used\nthe strlen() of the newly allocated buffer instead of the original\nbuffer).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n merge-recursive.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex 6a796f2..5375a1b 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -477,9 +477,9 @@ static char *unique_path(const char *pat\n \tchar *newpath = xmalloc(strlen(path) + 1 + strlen(branch) + 8 + 1);\n \tint suffix = 0;\n \tstruct stat st;\n-\tchar *p = newpath + strlen(newpath);\n+\tchar *p = newpath + strlen(path);\n \tstrcpy(newpath, path);\n-\tstrcat(newpath, \"~\");\n+\t*(p++) = '~';\n \tstrcpy(p, branch);\n \tfor (; *p; ++p)\n \t\tif ('/' == *p)\n-- \n1.4.2.rc2.geb7f\n"}]}