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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: pclouds
Date: Wednesday, October 18, 2006 - 6:34 pm

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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Don't segfault if the given SHA1 name is longer th ..., pclouds, (Wed Oct 18, 6:34 pm)
Re: [PATCH] Don't segfault if the given SHA1 name is longe ..., Nguyen Thai Ngoc Duy, (Wed Oct 18, 9:54 pm)