From: Tim Kientzle Date: Sat, 7 Feb 2015 06:45:58 +0000 (-0800) Subject: Issues 396, 397: Ignore entries with empty filenames. X-Git-Tag: v3.1.900a~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2e2abbb13ddcd962470cc1adb43b085f6e407a4;p=thirdparty%2Flibarchive.git Issues 396, 397: Ignore entries with empty filenames. Bugs in the rar and cab readers lead to returning entries with empty filenames. Make bsdtar resistant to this. Of course, we should also fix the rar and cab readers to handle these cases correctly and either return correctly-populated entries or fail cleanly. --- diff --git a/tar/read.c b/tar/read.c index 8267b70e3..430cff043 100644 --- a/tar/read.c +++ b/tar/read.c @@ -264,6 +264,12 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) } if (r == ARCHIVE_FATAL) break; + const char *p = archive_entry_pathname(entry); + if (p == NULL || p[0] == '\0') { + lafe_warnc(0, "Archive entry has empty or unreadable filename ... skipping."); + bsdtar->return_value = 1; + continue; + } if (bsdtar->uid >= 0) { archive_entry_set_uid(entry, bsdtar->uid);