]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Do something sensible for empty strings to make fuzzers happy.
authorJoerg Sonnenberger <joerg@bec.de>
Tue, 5 Sep 2017 16:12:19 +0000 (18:12 +0200)
committerJoerg Sonnenberger <joerg@bec.de>
Tue, 5 Sep 2017 16:12:19 +0000 (18:12 +0200)
libarchive/archive_read_support_format_xar.c

index 7a22beb9d8e43ba913f6832ea74f8364a2a854a2..93eeacc5e6ebc99b8d9d23f64f9ac41f5713fd52 100644 (file)
@@ -1040,6 +1040,9 @@ atol10(const char *p, size_t char_cnt)
        uint64_t l;
        int digit;
 
+       if (char_cnt == 0)
+               return (0);
+
        l = 0;
        digit = *p - '0';
        while (digit >= 0 && digit < 10  && char_cnt-- > 0) {
@@ -1054,7 +1057,10 @@ atol8(const char *p, size_t char_cnt)
 {
        int64_t l;
        int digit;
-        
+
+       if (char_cnt == 0)
+               return (0);
+
        l = 0;
        while (char_cnt-- > 0) {
                if (*p >= '0' && *p <= '7')