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.
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
/* 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;
}