Skip to content

Commit

Permalink
Fix segfault in php_stream_context_get_option call
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Jul 11, 2017
1 parent c620dae commit 2458dce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ PHP NEWS

- ZIP:
. ZipArchive implements countable, added ZipArchive::count() method. (Remi)
. Fix segfault in php_stream_context_get_option call. (Remi)

06 Jul 2017, PHP 7.2.0alpha3

Expand Down
2 changes: 1 addition & 1 deletion ext/zip/php_zip.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern zend_module_entry zip_module_entry;
#define ZIP_OVERWRITE ZIP_TRUNCATE
#endif

#define PHP_ZIP_VERSION "1.15.0"
#define PHP_ZIP_VERSION "1.15.1"

#define ZIP_OPENBASEDIR_CHECKPATH(filename) php_check_open_basedir(filename)

Expand Down
2 changes: 1 addition & 1 deletion ext/zip/zip_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ php_stream *php_stream_zip_opener(php_stream_wrapper *wrapper,
if (za) {
zval *tmpzval;

if (NULL != (tmpzval = php_stream_context_get_option(context, "zip", "password"))) {
if (context && NULL != (tmpzval = php_stream_context_get_option(context, "zip", "password"))) {
if (Z_TYPE_P(tmpzval) != IS_STRING || zip_set_default_password(za, Z_STRVAL_P(tmpzval))) {
php_error_docref(NULL, E_WARNING, "Can't set zip password");
}
Expand Down

0 comments on commit 2458dce

Please sign in to comment.