From: pclouds@gmail.com Date: Thu, 19 Oct 2006 01:34:41 +0000 (+0700) Subject: Reject hexstring longer than 40-bytes in get_short_sha1() X-Git-Tag: v1.4.3.1~4 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8a83157e04e8f9654b3573cf04276895b1cbd68a;p=git.git Reject hexstring longer than 40-bytes in get_short_sha1() 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 --- diff --git a/sha1_name.c b/sha1_name.c index 9b226e357..6ffee2208 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);