Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-18.03 36 lines 1.0 kB view raw
1From fa7438a0ff4033e4741c807394a9af6207940d71 Mon Sep 17 00:00:00 2001 2From: Joerg Sonnenberger <joerg@bec.de> 3Date: Tue, 5 Sep 2017 18:12:19 +0200 4Subject: [PATCH] Do something sensible for empty strings to make fuzzers 5 happy. 6 7--- 8 libarchive/archive_read_support_format_xar.c | 8 +++++++- 9 1 file changed, 7 insertions(+), 1 deletion(-) 10 11diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c 12index 7a22beb9d..93eeacc5e 100644 13--- a/libarchive/archive_read_support_format_xar.c 14+++ b/libarchive/archive_read_support_format_xar.c 15@@ -1040,6 +1040,9 @@ atol10(const char *p, size_t char_cnt) 16 uint64_t l; 17 int digit; 18 19+ if (char_cnt == 0) 20+ return (0); 21+ 22 l = 0; 23 digit = *p - '0'; 24 while (digit >= 0 && digit < 10 && char_cnt-- > 0) { 25@@ -1054,7 +1057,10 @@ atol8(const char *p, size_t char_cnt) 26 { 27 int64_t l; 28 int digit; 29- 30+ 31+ if (char_cnt == 0) 32+ return (0); 33+ 34 l = 0; 35 while (char_cnt-- > 0) { 36 if (*p >= '0' && *p <= '7')