summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 02a4a32)
raw | patch | inline | side by side (parent: 02a4a32)
author | Linus Torvalds <torvalds@osdl.org> | |
Sat, 13 Aug 2005 18:05:25 +0000 (11:05 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 14 Aug 2005 01:28:51 +0000 (18:28 -0700) |
The "get_sha1_hex()" function is designed to work with SHA1 hex strings
that may be followed by arbitrary crud. However, that's not acceptable for
"get_sha1()" which is used for command line arguments etc: we don't want
to silently allow random characters after the end of the SHA1.
So verify that the hex string is all we have.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
that may be followed by arbitrary crud. However, that's not acceptable for
"get_sha1()" which is used for command line arguments etc: we don't want
to silently allow random characters after the end of the SHA1.
So verify that the hex string is all we have.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_name.c | patch | blob | history |
diff --git a/sha1_name.c b/sha1_name.c
index df45b172a3033cad47e5039defc6de45748aeb5f..fdd321448ce144aac87c6e5e50cbe08054951feb 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
};
const char **p;
- if (!get_sha1_hex(str, sha1))
+ if (len == 40 && !get_sha1_hex(str, sha1))
return 0;
for (p = prefix; *p; p++) {