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
path: root/diff.c
diff options
context:
space:
mode:
authorJonas Fonseca <fonseca@diku.dk>2006-04-19 01:26:43 +0400
committerJunio C Hamano <junkio@cox.net>2006-04-19 01:44:58 +0400
commit8d6e10327dff232cc253a5753c43fb414fed4e00 (patch)
tree5694e904eb85edfc5ec880369532df7329634dc5 /diff.c
parent4baff50551545e2b6825973ec37bcaf03edb95fe (diff)
Fix filename scaling for binary files
Set maximum filename length for binary files so that scaling won't be triggered and result in invalid string access. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/diff.c b/diff.c
index 3a1e6ce619..903afa1689 100644
--- a/diff.c
+++ b/diff.c
@@ -250,13 +250,14 @@ static void show_stats(struct diffstat_t* data)
for (i = 0; i < data->nr; i++) {
struct diffstat_file *file = data->files[i];
+ len = strlen(file->name);
+ if (max_len < len)
+ max_len = len;
+
if (file->is_binary || file->is_unmerged)
continue;
if (max_change < file->added + file->deleted)
max_change = file->added + file->deleted;
- len = strlen(file->name);
- if (max_len < len)
- max_len = len;
}
for (i = 0; i < data->nr; i++) {