mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix #70103: Fix bug 70103 when ZTS is enabled
Used snprintf to copy the basename string before it is freed
This commit is contained in:
parent
ba0751a915
commit
ad08aa3956
2 changed files with 7 additions and 6 deletions
3
NEWS
3
NEWS
|
@ -15,7 +15,8 @@ PHP NEWS
|
||||||
. Fixed bug #69442 (closing of fd incorrect when PTS enabled). (jaytaph)
|
. Fixed bug #69442 (closing of fd incorrect when PTS enabled). (jaytaph)
|
||||||
|
|
||||||
- ZIP:
|
- ZIP:
|
||||||
. Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb)
|
. Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb,
|
||||||
|
Mitch Hagstrand)
|
||||||
|
|
||||||
19 Jan 2017 PHP 7.0.15
|
19 Jan 2017 PHP 7.0.15
|
||||||
|
|
||||||
|
|
|
@ -1699,18 +1699,18 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
|
||||||
zval_ptr_dtor(return_value);
|
zval_ptr_dtor(return_value);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(entry_name_buf, MAXPATHLEN, "%s%s", add_path, file_stripped);
|
snprintf(entry_name_buf, MAXPATHLEN, "%s%s", add_path, file_stripped);
|
||||||
entry_name = entry_name_buf;
|
|
||||||
entry_name_len = strlen(entry_name);
|
|
||||||
} else {
|
} else {
|
||||||
entry_name = file_stripped;
|
snprintf(entry_name_buf, MAXPATHLEN, "%s", file_stripped);
|
||||||
entry_name_len = file_stripped_len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entry_name = entry_name_buf;
|
||||||
|
entry_name_len = strlen(entry_name);
|
||||||
if (basename) {
|
if (basename) {
|
||||||
zend_string_release(basename);
|
zend_string_release(basename);
|
||||||
basename = NULL;
|
basename = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file),
|
if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file),
|
||||||
entry_name, entry_name_len, 0, 0) < 0) {
|
entry_name, entry_name_len, 0, 0) < 0) {
|
||||||
zval_dtor(return_value);
|
zval_dtor(return_value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue