From e3008464e70d25b4926b97b1f86951d7a3cb938d Mon Sep 17 00:00:00 2001 From: Sean Date: Mon, 22 May 2006 20:36:34 -0400 Subject: [PATCH] Avoid segfault in diff --stat rename output. Signed-off-by: Sean Estabrooks Signed-off-by: Junio C Hamano --- diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, -- 2.30.2