Skip to content

Commit 09c223d

Browse files
committed
Fix leak when path is too long in ZipArchive::extractTo()
I did not find an easy way to trigger this branch without also triggering some other error conditions earlier. Closes GH-19002.
1 parent 11ea995 commit 09c223d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ PHP NEWS
4242
. Fixed GH-13264 (fgets() and stream_get_line() do not return false on filter
4343
fatal error). (Jakub Zelenka)
4444

45+
- Zip:
46+
. Fix leak when path is too long in ZipArchive::extractTo(). (nielsdos)
47+
4548
03 Jul 2025, PHP 8.3.23
4649

4750
- Core:

ext/zip/php_zip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, const char *file, s
218218
return 0;
219219
} else if (len > MAXPATHLEN) {
220220
php_error_docref(NULL, E_WARNING, "Full extraction path exceed MAXPATHLEN (%i)", MAXPATHLEN);
221+
efree(fullpath);
221222
efree(file_dirname_fullpath);
222223
zend_string_release_ex(file_basename, 0);
223224
CWD_STATE_FREE(new_state.cwd);

0 commit comments

Comments
 (0)