summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
authorMitch Hagstrand <mhagstrand@gmail.com>2017-01-06 02:14:12 -0800
committerChristoph M. Becker <cmbecker69@gmx.de>2017-01-06 15:26:17 +0100
commitad08aa39561eb6aa3d03b2be06ed3894dbb2892c (patch)
tree4e4e3e1ef61044514cf20564cf1879adb05623c8 /ext/zip/php_zip.c
parentba0751a9152b647a55774b407210248d95876fc0 (diff)
downloadphp-git-ad08aa39561eb6aa3d03b2be06ed3894dbb2892c.tar.gz
Fix #70103: Fix bug 70103 when ZTS is enabled
Used snprintf to copy the basename string before it is freed
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r--ext/zip/php_zip.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 67204b08b4..20c4e86de0 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1699,18 +1699,18 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
zval_ptr_dtor(return_value);
RETURN_FALSE;
}
-
snprintf(entry_name_buf, MAXPATHLEN, "%s%s", add_path, file_stripped);
- entry_name = entry_name_buf;
- entry_name_len = strlen(entry_name);
} else {
- entry_name = file_stripped;
- entry_name_len = file_stripped_len;
+ snprintf(entry_name_buf, MAXPATHLEN, "%s", file_stripped);
}
+
+ entry_name = entry_name_buf;
+ entry_name_len = strlen(entry_name);
if (basename) {
zend_string_release(basename);
basename = NULL;
}
+
if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file),
entry_name, entry_name_len, 0, 0) < 0) {
zval_dtor(return_value);