summaryrefslogtreecommitdiff
path: root/tar/read.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@acm.org>2015-02-06 22:45:58 -0800
committerTim Kientzle <kientzle@acm.org>2015-02-06 22:45:58 -0800
commitb2e2abbb13ddcd962470cc1adb43b085f6e407a4 (patch)
tree3770ee44e0308d0751176646dc290d3b16051746 /tar/read.c
parent24f5de6560f31a67bfdf5ddec367e70ecfa9e440 (diff)
downloadlibarchive-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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tar/read.c b/tar/read.c
index 8267b70e..430cff04 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);