Skip to content

Commit

Permalink
resolve_ref(): do not follow incorrectly-formatted symbolic refs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Oct 5, 2011
1 parent c224ca7 commit 313fb01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 313fb01

Please sign in to comment.