From 8a83157e04e8f9654b3573cf04276895b1cbd68a Mon Sep 17 00:00:00 2001 From: "pclouds@gmail.com" Date: Thu, 19 Oct 2006 08:34:41 +0700 Subject: [PATCH] Reject hexstring longer than 40-bytes in get_short_sha1() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Such a string can never be a valid object name. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- sha1_name.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sha1_name.c b/sha1_name.c index 9b226e3579..6ffee22081 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -157,7 +157,7 @@ static int get_short_sha1(const char *name, int len, unsigned char *sha1, 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); -- 2.11.4.GIT