diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-03 11:51:46 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-03 11:53:03 +0100 |
commit | 3e5675d730c6fb099ebb1b9f645bdb3ba6b86d85 (patch) | |
tree | 9c34a503388be01e043bc95a8335eff6bb2a6800 | |
parent | 6f63e053201a5284d5b3ed2d2c369bb72500c345 (diff) | |
download | php-git-3e5675d730c6fb099ebb1b9f645bdb3ba6b86d85.tar.gz |
Remove unnecessary strncpy in zip
This causes a warning on GCC 9 and is unnecessary to boot: We
only use "cwd" for the open_basedir check, so we can just as well
pass in the original string.
-rw-r--r-- | ext/zip/php_zip.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 966efb58e6..9520ecb9ca 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -509,9 +509,9 @@ static char * php_zipobj_get_zip_comment(struct zip *za, int *len) /* {{{ */ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_value) /* {{{ */ { #ifdef HAVE_GLOB - char cwd[MAXPATHLEN]; int cwd_skip = 0; #ifdef ZTS + char cwd[MAXPATHLEN]; char work_pattern[MAXPATHLEN]; char *result; #endif @@ -574,8 +574,7 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v /* we assume that any glob pattern will match files from one directory only so checking the dirname of the first match should be sufficient */ - strncpy(cwd, globbuf.gl_pathv[0], MAXPATHLEN); - if (ZIP_OPENBASEDIR_CHECKPATH(cwd)) { + if (ZIP_OPENBASEDIR_CHECKPATH(globbuf.gl_pathv[0])) { return -1; } |