From d3cd6a5052c9595fb6b42393ee6cb53c0e6b4a13 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 --- main/network.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/network.c b/main/network.c index a1165f6a29d6b..1133bbb3e86cb 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