Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
resolve_ref(): also treat a too-long SHA1 as invalid
author
Michael Haggerty
<mhagger@alum.mit.edu>
Thu, 15 Sep 2011 21:10:41 +0000
(23:10 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 5 Oct 2011 20:45:31 +0000
(13:45 -0700)
If the SHA1 in a reference file is not terminated by a space or
end-of-file, consider it malformed and emit a warning.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
629cd3a
)
diff --git
a/refs.c
b/refs.c
index 2387f4e735e15c95192a82467c778f3ba38f01a0..0baa500cbbda44a6700527d259b26acf6ba92722 100644
(file)
--- a/
refs.c
+++ b/
refs.c
@@
-593,7
+593,8
@@
const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
if (flag)
*flag |= REF_ISSYMREF;
}
- if (get_sha1_hex(buffer, sha1)) {
+ /* Please note that FETCH_HEAD has a second line containing other data. */
+ if (get_sha1_hex(buffer, sha1) || (buffer[40] != '\0' && !isspace(buffer[40]))) {
warning("reference in %s is formatted incorrectly", path);
return NULL;
}