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