From 1f58a0383857e5328e3e4d248d6c4a3485098679 Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Thu, 15 Sep 2011 23:10:33 +0200 Subject: [PATCH] resolve_ref(): only follow a symlink that contains a valid, normalized refname Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index da9737f99..8f0b87184 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) -- 2.26.2