From: Sean Date: Tue, 23 May 2006 00:36:34 +0000 (-0400) Subject: Avoid segfault in diff --stat rename output. X-Git-Tag: v1.4.0-rc1~97 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e3008464e70d25b4926b97b1f86951d7a3cb938d;p=git.git Avoid segfault in diff --stat rename output. Signed-off-by: Sean Estabrooks Signed-off-by: Junio C Hamano --- diff --git a/diff.c b/diff.c index 160178367..3a2a175c7 100644 --- a/diff.c +++ b/diff.c @@ -237,7 +237,7 @@ static char *pprint_rename(const char *a, const char *b) if (a_midlen < 0) a_midlen = 0; if (b_midlen < 0) b_midlen = 0; - name = xmalloc(len_a + len_b - pfx_length - sfx_length + 7); + name = xmalloc(pfx_length + a_midlen + b_midlen + sfx_length + 7); sprintf(name, "%.*s{%.*s => %.*s}%s", pfx_length, a, a_midlen, a + pfx_length,