Skip to content

Commit

Permalink
Do something sensible for empty strings to make fuzzers happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonn committed Sep 5, 2017
1 parent 25d20ec commit fa7438a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libarchive/archive_read_support_format_xar.c
Expand Up @@ -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) {
Expand All @@ -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')
Expand Down

2 comments on commit fa7438a

@carnil
Copy link

@carnil carnil commented on fa7438a Sep 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should fix #935

@carnil
Copy link

@carnil carnil commented on fa7438a Sep 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CVE-2017-14166 was assigned for this issue.

Please sign in to comment.