Blame SOURCES/libarchive-3.1.2-CVE-2015-8916-CVE-2015-8917.patch

58251f
From b2e2abbb13ddcd962470cc1adb43b085f6e407a4 Mon Sep 17 00:00:00 2001
58251f
From: Tim Kientzle <kientzle@acm.org>
58251f
Date: Fri, 6 Feb 2015 22:45:58 -0800
58251f
Subject: [PATCH] Issues 396, 397: Ignore entries with empty filenames.
58251f
58251f
Bugs in the rar and cab readers lead to returning entries
58251f
with empty filenames.  Make bsdtar resistant to this.
58251f
58251f
Of course, we should also fix the rar and cab
58251f
readers to handle these cases correctly and either
58251f
return correctly-populated entries or fail cleanly.
58251f
---
58251f
 tar/read.c | 6 ++++++
58251f
 1 file changed, 6 insertions(+)
58251f
58251f
diff --git a/tar/read.c b/tar/read.c
58251f
index 8267b70..430cff0 100644
58251f
--- a/tar/read.c
58251f
+++ b/tar/read.c
58251f
@@ -264,6 +264,12 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer)
58251f
 		}
58251f
 		if (r == ARCHIVE_FATAL)
58251f
 			break;
58251f
+		const char *p = archive_entry_pathname(entry);
58251f
+		if (p == NULL || p[0] == '\0') {
58251f
+			lafe_warnc(0, "Archive entry has empty or unreadable filename ... skipping.");
58251f
+			bsdtar->return_value = 1;
58251f
+			continue;
58251f
+		}
58251f
 
58251f
 		if (bsdtar->uid >= 0) {
58251f
 			archive_entry_set_uid(entry, bsdtar->uid);
58251f
-- 
58251f
2.7.4
58251f