From 3e5675d730c6fb099ebb1b9f645bdb3ba6b86d85 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 3 Jan 2020 11:51:46 +0100 Subject: [PATCH] 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. --- ext/zip/php_zip.c | 5 ++--- 1 file 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; } -- 2.50.1