From: Jonas Fonseca Date: Tue, 18 Apr 2006 21:26:43 +0000 (+0200) Subject: Fix filename scaling for binary files X-Git-Tag: v1.3.1~13 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8d6e10327dff232cc253a5753c43fb414fed4e00;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/diff.c b/diff.c index 3a1e6ce61..903afa168 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++) {