summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorpclouds@gmail.com <pclouds@gmail.com>2006-10-19 08:34:41 +0700
committerJunio C Hamano <junkio@cox.net>2006-10-18 21:21:50 -0700
commit8a83157e04e8f9654b3573cf04276895b1cbd68a (patch)
tree569384c85d49f1d0f981d594e1d4de424b9d464c /sha1_name.c
parent1a3b55c6b424904835ebfd74c992a5bffbaa7e7e (diff)
downloadgit-8a83157e04e8f9654b3573cf04276895b1cbd68a.tar.gz
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>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c2
1 files changed, 1 insertions, 1 deletions
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);