From 5dd965117a1d88cbd99dac9bf097d82c83819f69 Mon Sep 17 00:00:00 2001 From: dixyes Date: Sat, 26 Jul 2025 00:41:59 +0800 Subject: [PATCH] Free opened_path when opened_path_len >= MAXPATHLEN Closes GH-19240. --- NEWS | 3 +++ main/php_open_temporary_file.c | 1 + 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 2b21969dffb..94a14290a8b 100644 --- a/NEWS +++ b/NEWS @@ -39,6 +39,9 @@ PHP NEWS (ilutov) . Fix theoretical issues with hrtime() not being available. (nielsdos) +- Windows: + . Free opened_path when opened_path_len >= MAXPATHLEN. (dixyes) + 31 Jul 2025, PHP 8.3.24 - Calendar: diff --git a/main/php_open_temporary_file.c b/main/php_open_temporary_file.c index dcea7835848..608f3ecf73b 100644 --- a/main/php_open_temporary_file.c +++ b/main/php_open_temporary_file.c @@ -157,6 +157,7 @@ static int php_do_open_temporary_file(const char *path, const char *pfx, zend_st free(cwdw); free(pfxw); efree(new_state.cwd); + free(opened_path); return -1; } assert(strlen(opened_path) == opened_path_len);