]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-compat-util.h
Merge branch 'jk/war-on-sprintf'
[thirdparty/git.git] / git-compat-util.h
index 9a3e5591cb4fd032ed9447ef09873b5da2f32266..88964f7886b1f6d7445b77a26eceb65d48c3b6b8 100644 (file)
@@ -817,6 +817,9 @@ static inline int strtoul_ui(char const *s, int base, unsigned int *result)
        char *p;
 
        errno = 0;
+       /* negative values would be accepted by strtoul */
+       if (strchr(s, '-'))
+               return -1;
        ul = strtoul(s, &p, base);
        if (errno || *p || p == s || (unsigned int) ul != ul)
                return -1;