git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix filename scaling for binary files

From
Jonas Fonseca <fonseca@diku.dk>
Date
Apr 18, 2006, 21:26 UTC
Message-ID
<20060418212643.GA30478@diku.dk>

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
Message 1 of 1 in “Fix filename scaling for binary files”
  1. Fix filename scaling for binary filesJonas Fonseca, Apr 18, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.