diff options
author | Tim Kientzle <kientzle@acm.org> | 2015-02-06 22:45:58 -0800 |
---|---|---|
committer | Tim Kientzle <kientzle@acm.org> | 2015-02-06 22:45:58 -0800 |
commit | b2e2abbb13ddcd962470cc1adb43b085f6e407a4 (patch) | |
tree | 3770ee44e0308d0751176646dc290d3b16051746 /tar/read.c | |
parent | 24f5de6560f31a67bfdf5ddec367e70ecfa9e440 (diff) | |
download | libarchive-b2e2abbb13ddcd962470cc1adb43b085f6e407a4.tar.gz |
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.
Diffstat (limited to 'tar/read.c')
-rw-r--r-- | tar/read.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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); |