com php-src: Better fix for bug #70433: ext/phar/dirstream.c ext/phar/util.c ext/phar/zip.c
| From: | Stanislav Malyshev | Date: | Tue, 29 Sep 2015 04:41:02 +0000 |
| Subject: | com php-src: Better fix for bug #70433: ext/phar/dirstream.c ext/phar/util.c ext/phar/zip.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89197@lists.php.net to get a copy of this message | ||
Commit: 1ddf72180a52d247db88ea42a3e35f824a8fbda1
Author: Stanislav Malyshev <stas@php.net> Mon, 28 Sep 2015 21:37:26 -0700
Parents: f98ab19dc0c978e3caaa2614579e4a61f2c317f5
Branches: PHP-5.5 PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1ddf72180a52d247db88ea42a3e35f824a8fbda1
Log:
Better fix for bug #70433
Bugs:
https://bugs.php.net/70433
Changed paths:
M ext/phar/dirstream.c
M ext/phar/util.c
M ext/phar/zip.c
Diff:
diff --git a/ext/phar/dirstream.c b/ext/phar/dirstream.c
index 4728e29..75cf049 100644
--- a/ext/phar/dirstream.c
+++ b/ext/phar/dirstream.c
@@ -207,7 +207,7 @@ static php_stream *phar_make_dirstream(char *dir, HashTable *manifest TSRMLS_DC)
zend_hash_internal_pointer_reset(manifest);
while (FAILURE != zend_hash_has_more_elements(manifest)) {
- if (HASH_KEY_IS_STRING != zend_hash_get_current_key_ex(manifest, &key, &keylen,
&unused, 0, NULL)) {
+ if (HASH_KEY_NON_EXISTENT == zend_hash_get_current_key_ex(manifest, &key, &keylen,
&unused, 0, NULL)) {
break;
}
diff --git a/ext/phar/util.c b/ext/phar/util.c
index e7decda..303daed 100644
--- a/ext/phar/util..c
+++ b/ext/phar/util.c
@@ -1977,7 +1977,7 @@ void phar_add_virtual_dirs(phar_archive_data *phar, char *filename, int
filename
while ((s = zend_memrchr(filename, '/', filename_len))) {
filename_len = s - filename;
- if (FAILURE == zend_hash_add_empty_element(&phar->virtual_dirs, filename, filename_len)) {
+ if (!filename_len || FAILURE == zend_hash_add_empty_element(&phar->virtual_dirs, filename,
filename_len)) {
break;
}
}
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index 142165c..e4883d3 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -396,7 +396,9 @@ foundit:
if (entry.filename[entry.filename_len - 1] == '/') {
entry.is_dir = 1;
- entry.filename_len--;
+ if(entry.filename_len > 1) {
+ entry.filename_len--;
+ }
entry.flags |= PHAR_ENT_PERM_DEF_DIR;
} else {
entry.is_dir = 0;