resolve_ref(): verify that the input refname has the right format
authorMichael Haggerty <mhagger@alum.mit.edu>
Thu, 15 Sep 2011 21:10:39 +0000 (23:10 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Oct 2011 20:45:31 +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 b0555018995e5f029f3dd1d014e1ac9ef74c3672..ee3e0cc560eafc1c32104fa439a070c00fdcc12a 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -504,6 +504,9 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
        if (flag)
                *flag = 0;
 
+       if (check_refname_format(ref, REFNAME_ALLOW_ONELEVEL))
+               return NULL;
+
        for (;;) {
                char path[PATH_MAX];
                struct stat st;