]> granicus.if.org Git - git/commitdiff
refname_is_safe(): don't allow the empty string
authorMichael Haggerty <mhagger@alum.mit.edu>
Wed, 27 Apr 2016 10:42:27 +0000 (12:42 +0200)
committerMichael Haggerty <mhagger@alum.mit.edu>
Thu, 5 May 2016 14:37:30 +0000 (16:37 +0200)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
refs.c

diff --git a/refs.c b/refs.c
index 5789152743ffbf0ac0f9a0270e2d689349cf7682..ca0280f7eb6898a0fb7a5f2ccc2ec42f94860189 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -136,11 +136,12 @@ int refname_is_safe(const char *refname)
                free(buf);
                return result;
        }
-       while (*refname) {
+
+       do {
                if (!isupper(*refname) && *refname != '_')
                        return 0;
                refname++;
-       }
+       } while (*refname);
        return 1;
 }