Code

resolve_ref(): verify that the input refname has the right format
[git.git] / 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;