Blame SOURCES/php-5.5.21-CVE-2015-4021.patch

30ceb2
From c27f012b7a447e59d4a704688971cbfa7dddaa74 Mon Sep 17 00:00:00 2001
30ceb2
From: Stanislav Malyshev <stas@php.net>
30ceb2
Date: Wed, 29 Apr 2015 22:04:20 -0700
30ceb2
Subject: [PATCH] Fix bug #69453 - don't try to cut empty string
30ceb2
30ceb2
---
30ceb2
 ext/phar/tar.c               |  2 +-
30ceb2
 ext/phar/tests/bug69453.phpt | 21 +++++++++++++++++++++
30ceb2
 2 files changed, 22 insertions(+), 1 deletion(-)
30ceb2
 create mode 100644 ext/phar/tests/bug69453.phpt
30ceb2
30ceb2
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
30ceb2
index ca8eafc..d6d63e6 100644
30ceb2
--- a/ext/phar/tar.c
30ceb2
+++ b/ext/phar/tar.c
30ceb2
@@ -425,7 +425,7 @@ bail:
30ceb2
 			entry.filename_len = i;
30ceb2
 			entry.filename = pestrndup(hdr->name, i, myphar->is_persistent);
30ceb2
 
30ceb2
-			if (entry.filename[entry.filename_len - 1] == '/') {
30ceb2
+			if (i > 0 && entry.filename[entry.filename_len - 1] == '/') {
30ceb2
 				/* some tar programs store directories with trailing slash */
30ceb2
 				entry.filename[entry.filename_len - 1] = '\0';
30ceb2
 				entry.filename_len--;
30ceb2
-- 
30ceb2
2.1.4
30ceb2