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

[PATCH] Don't segfault if the given SHA1 name is longer than 40 characters

From
pclouds@gmail.com <pclouds@gmail.com>
Date
Oct 19, 2006, 01:34 UTC
Message-ID
<20061019013441.GB9379@localhost>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 sha1_name.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sha1_name.c b/sha1_name.c
index 9b226e3..6ffee22 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -157,7 +157,7 @@ static int get_short_sha1(const char *na
 	char canonical[40];
 	unsigned char res[20];
 
-	if (len < MINIMUM_ABBREV)
+	if (len < MINIMUM_ABBREV || len > 40)
 		return -1;
 	hashclr(res);
 	memset(canonical, 'x', 40);
-- 
1.4.3.rc2.g0503-dirty
Next: Junio C Hamano
Message 1 of 3 in “Don't segfault if the given SHA1 name is longer than 40 characters”
  1. Don't segfault if the given SHA1 name is longer than 40 characterspclouds@gmail.com, Oct 19, 2006
  2. Junio C HamanoOct 19, 2006
  3. Nguyen Thai Ngoc DuyOct 19, 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.