diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2011-09-15 23:10:36 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-05 13:45:31 -0700 |
commit | 313fb010da4343eca22ee48a2cc18048d999de53 (patch) | |
tree | 18c79b386041e5aabee16bfd81569a0eb5478cd1 | |
parent | resolve_ref(): extract a function get_packed_ref() (diff) | |
download | tgif-313fb010da4343eca22ee48a2cc18048d999de53.tar.xz |
resolve_ref(): do not follow incorrectly-formatted symbolic refs
Emit a warning and fail if a symbolic reference refers to an
incorrectly-formatted refname.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | refs.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -581,6 +581,11 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int * buf = buffer + 4; while (isspace(*buf)) buf++; + if (check_refname_format(buf, REFNAME_ALLOW_ONELEVEL)) { + warning("symbolic reference in %s is formatted incorrectly", + path); + return NULL; + } ref = strcpy(ref_buffer, buf); if (flag) *flag |= REF_ISSYMREF; |