public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku•dk>
To: Junio C Hamano <junkio@cox•net>, Git Mailing List <git@vger•kernel.org>
Subject: [PATCH] Fix filename scaling for binary files
Date: Tue, 18 Apr 2006 23:26:43 +0200	[thread overview]
Message-ID: <20060418212643.GA30478@diku.dk> (raw)

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>

---

 diff.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/diff.c b/diff.c
index b54bbfa..ddcfb84 100644
--- a/diff.c
+++ b/diff.c
@@ -250,13 +250,14 @@ static void show_stats(struct diffstat_t
 	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++) {

-- 
Jonas Fonseca

                 reply	other threads:[~2006-04-18 21:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060418212643.GA30478@diku.dk \
    --to=fonseca@diku$(echo .)dk \
    --cc=git@vger$(echo .)kernel.org \
    --cc=junkio@cox$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox