diff --git a/sha1_name.c b/sha1_name.c
index 9b226e3579b68fe8b59c7105bd926e3a0a70b0ad..6ffee22081aee3fc7b27b9ccc93c4c721652ec4b 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
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);