Skip to content

Commit e70f9fa

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: Update NEWS Fixed bug #72660 (NULL Pointer dereference in zend_virtual_cwd)
2 parents 39ac632 + 3d33eb7 commit e70f9fa

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

ext/zip/php_zip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,10 +1619,10 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
16191619
{
16201620
struct zip *intern;
16211621
zval *self = getThis();
1622-
char *path = NULL;
1622+
char *path = ".";
16231623
char *remove_path = NULL;
16241624
char *add_path = NULL;
1625-
size_t add_path_len, remove_path_len = 0, path_len = 0;
1625+
size_t add_path_len, remove_path_len = 0, path_len = 1;
16261626
zend_long remove_all_path = 0;
16271627
zend_long flags = 0;
16281628
zval *options = NULL;

ext/zip/tests/bug72660.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #72660 (NULL Pointer dereference in zend_virtual_cwd)
3+
--SKIPIF--
4+
<?php
5+
if(!extension_loaded('zip')) die('skip');
6+
if(PHP_ZTS == 0) { die('skip ZTS required'); }
7+
?>
8+
--FILE--
9+
<?php
10+
$zip = new ZipArchive();
11+
$zip->open(dirname(__FILE__) . "/bug72660.zip", ZIPARCHIVE::CREATE);
12+
$zip->addPattern("/noexists/");
13+
?>
14+
okey
15+
--CLEAN--
16+
<?php
17+
@unlink(dirname(__FILE__) . "/bug72660.zip");
18+
?>
19+
--EXPECT--
20+
okey

0 commit comments

Comments
 (0)