提交 8a83157e 编写于 作者: P pclouds@gmail.com 提交者: Junio C Hamano

Reject hexstring longer than 40-bytes in get_short_sha1()

Such a string can never be a valid object name.
Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 1a3b55c6
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册