summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorSean <seanlkml@sympatico.ca>2006-05-23 00:36:34 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-05-23 01:00:38 (GMT)
commite3008464e70d25b4926b97b1f86951d7a3cb938d (patch)
treed4dd1d5b3af849e6f4d83638d16bad9be6825dd8 /diff.c
parent884e3134a0002af1f8842768873fe9d041ed9a76 (diff)
downloadgit-e3008464e70d25b4926b97b1f86951d7a3cb938d.zip
git-e3008464e70d25b4926b97b1f86951d7a3cb938d.tar.gz
git-e3008464e70d25b4926b97b1f86951d7a3cb938d.tar.bz2
Avoid segfault in diff --stat rename output.
Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index 1601783..3a2a175 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,