From 40551dd74bcfeae961c616230f9eccff2df97177 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Mon, 22 Jul 2024 18:29:48 +0200 Subject: [PATCH] Fix uninitialized memory in network.c See https://github.com/php/php-src/issues/14806#issuecomment-2208150509 and https://github.com/php/php-src/issues/14806#issuecomment-2208690481 Closes GH-15068. --- NEWS | 1 + main/network.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 52cd632c1d3..15e260714bd 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ PHP NEWS . Fixed bug GH-15023 (Memory leak in Zend/zend_ini.c). (nielsdos) . Fixed bug GH-13330 (Append -Wno-implicit-fallthrough flag conditionally). (Peter Kokot) + . Fix uninitialized memory in network.c. (nielsdos) - Curl: . Fixed case when curl_error returns an empty string. diff --git a/main/network.c b/main/network.c index a1165f6a29d..1133bbb3e86 100644 --- a/main/network.c +++ b/main/network.c @@ -861,7 +861,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short #if HAVE_IPV6 && HAVE_INET_PTON struct sockaddr_in6 in6; #endif - } local_address; + } local_address = {0}; int local_address_len = 0; if (sa->sa_family == AF_INET) { @@ -873,7 +873,6 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short local_address_len = sizeof(struct sockaddr_in); local_address.in4.sin_family = sa->sa_family; local_address.in4.sin_port = htons(bindport); - memset(&(local_address.in4.sin_zero), 0, sizeof(local_address.in4.sin_zero)); } } #if HAVE_IPV6 && HAVE_INET_PTON