Skip to content

Commit f23378d

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Remove unnecessary strncpy in zip
2 parents 0e6cff7 + 3e5675d commit f23378d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ext/zip/php_zip.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,9 @@ static char * php_zipobj_get_zip_comment(struct zip *za, int *len) /* {{{ */
508508
int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_value) /* {{{ */
509509
{
510510
#ifdef HAVE_GLOB
511-
char cwd[MAXPATHLEN];
512511
int cwd_skip = 0;
513512
#ifdef ZTS
513+
char cwd[MAXPATHLEN];
514514
char work_pattern[MAXPATHLEN];
515515
char *result;
516516
#endif
@@ -573,8 +573,7 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
573573

574574
/* we assume that any glob pattern will match files from one directory only
575575
so checking the dirname of the first match should be sufficient */
576-
strncpy(cwd, globbuf.gl_pathv[0], MAXPATHLEN);
577-
if (ZIP_OPENBASEDIR_CHECKPATH(cwd)) {
576+
if (ZIP_OPENBASEDIR_CHECKPATH(globbuf.gl_pathv[0])) {
578577
return -1;
579578
}
580579

0 commit comments

Comments
 (0)