summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2011-09-15 23:10:33 +0200
committerJunio C Hamano <gitster@pobox.com>2011-10-05 13:45:30 -0700
commit1f58a0383857e5328e3e4d248d6c4a3485098679 (patch)
treec9d82d75c1569fa7baea45f0b12b768e92dcc747 /refs.c
parentb54cb795970628714a3a9fa0f4a73cd117b0207f (diff)
downloadgit-1f58a0383857e5328e3e4d248d6c4a3485098679.tar.gz
resolve_ref(): only follow a symlink that contains a valid, normalized refname
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index da9737f992..8f0b87184b 100644
--- a/refs.c
+++ b/refs.c
@@ -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)