Skip to content

Commit 0492064

Browse files
maxcreesremicollet
authored andcommitted
Fix #79424 ext/zip: don't use gl_pathc after call to globfree
This breaks on Linux with the musl libc, since it zeroes out gl_pathc during globfree.
1 parent 7f9b534 commit 0492064

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ PHP NEWS
3434

3535
- Zip:
3636
. Fixed Bug #79296 (ZipArchive::open fails on empty file). (Remi)
37+
. Fixed bug #79424 (php_zip_glob uses gl_pathc after call to globfree).
38+
(Max Rees)
3739

3840
19 Mar 2020, PHP 7.3.16
3941

ext/zip/php_zip.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,8 +606,9 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
606606
add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip);
607607
}
608608

609+
ret = globbuf.gl_pathc;
609610
globfree(&globbuf);
610-
return globbuf.gl_pathc;
611+
return ret;
611612
#else
612613
zend_throw_error(NULL, "Glob support is not available");
613614
return 0;

0 commit comments

Comments
 (0)