Skip to content

Commit 6baec62

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix three Win32-only defects in proc_open descriptor handling
2 parents 6bad8fd + 8d0d630 commit 6baec62

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ PHP NEWS
5353
. Fixed a crash when SQLite3::close() is called from a userland callback.
5454
(Ilia Alshanetsky)
5555

56+
- Standard:
57+
. Fixed three Windows-only proc_open() defects: an uninitialized
58+
PROCESS_INFORMATION, an indeterminate comspec pointer after a failed
59+
lookup, and an unchecked CreateFileA() failure. (Ilia Alshanetsky)
60+
5661

5762
24 Sep 2026, PHP 8.5.11
5863

ext/standard/proc_open.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ static void init_startup_info(STARTUPINFOW *si, descriptorspec_item *descriptors
691691

692692
static void init_process_info(PROCESS_INFORMATION *pi)
693693
{
694-
memset(&pi, 0, sizeof(pi));
694+
memset(pi, 0, sizeof(*pi));
695695
}
696696

697697
/* on success, returns length of *comspec, which then needs to be efree'd by caller */
@@ -742,7 +742,7 @@ static size_t find_comspec_nt(wchar_t **comspec)
742742

743743
static zend_result convert_command_to_use_shell(wchar_t **cmdw, size_t cmdw_len)
744744
{
745-
wchar_t *comspec;
745+
wchar_t *comspec = NULL;
746746
size_t len = find_comspec_nt(&comspec);
747747
if (len == 0) {
748748
php_error_docref(NULL, E_WARNING, "Command conversion failed");
@@ -827,7 +827,7 @@ static zend_result set_proc_descriptor_to_blackhole(descriptorspec_item *desc)
827827
#ifdef PHP_WIN32
828828
desc->childend = CreateFileA("nul", GENERIC_READ | GENERIC_WRITE,
829829
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
830-
if (desc->childend == NULL) {
830+
if (desc->childend == INVALID_HANDLE_VALUE) {
831831
php_error_docref(NULL, E_WARNING, "Failed to open nul");
832832
return FAILURE;
833833
}

0 commit comments

Comments
 (0)