Skip to content

Commit

Permalink
resolve_ref(): only follow a symlink that contains a valid, normalize…
Browse files Browse the repository at this point in the history
…d 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 b54cb79 commit 1f58a03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
if (len < 0)
return NULL;
buffer[len] = 0;
if (!prefixcmp(buffer, "refs/")) {
if (!prefixcmp(buffer, "refs/") &&
!check_refname_format(buffer, 0)) {
strcpy(ref_buffer, buffer);
ref = ref_buffer;
if (flag)
Expand Down

0 comments on commit 1f58a03

Please sign in to comment.