1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-06 11:26:10 +02:00

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 <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
pclouds@gmail.com 2006-10-19 08:34:41 +07:00 committed by Junio C Hamano
parent 1a3b55c6b4
commit 8a83157e04

View File

@ -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);