Skip to content

Commit fa7438a

Browse files
committed
Do something sensible for empty strings to make fuzzers happy.
1 parent 25d20ec commit fa7438a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: libarchive/archive_read_support_format_xar.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,9 @@ atol10(const char *p, size_t char_cnt)
10401040
uint64_t l;
10411041
int digit;
10421042

1043+
if (char_cnt == 0)
1044+
return (0);
1045+
10431046
l = 0;
10441047
digit = *p - '0';
10451048
while (digit >= 0 && digit < 10 && char_cnt-- > 0) {
@@ -1054,7 +1057,10 @@ atol8(const char *p, size_t char_cnt)
10541057
{
10551058
int64_t l;
10561059
int digit;
1057-
1060+
1061+
if (char_cnt == 0)
1062+
return (0);
1063+
10581064
l = 0;
10591065
while (char_cnt-- > 0) {
10601066
if (*p >= '0' && *p <= '7')

0 commit comments

Comments
 (0)