Code

resolve_ref(): only follow a symlink that contains a valid, normalized refname
authorMichael Haggerty <mhagger@alum.mit.edu>
Thu, 15 Sep 2011 21:10:33 +0000 (23:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Oct 2011 20:45:30 +0000 (13:45 -0700)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c

diff --git a/refs.c b/refs.c
index da9737f9920b7592b271c1fe7b1864ecd4d80ce4..8f0b87184b1e2c17ad76329f47f96961d76fe003 100644 (file)
--- 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)