Skip to content

Commit 40551dd

Browse files
committed
Fix uninitialized memory in network.c
See #14806 (comment) and #14806 (comment) Closes GH-15068.
1 parent 929536b commit 40551dd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PHP NEWS
88
. Fixed bug GH-15023 (Memory leak in Zend/zend_ini.c). (nielsdos)
99
. Fixed bug GH-13330 (Append -Wno-implicit-fallthrough flag conditionally).
1010
(Peter Kokot)
11+
. Fix uninitialized memory in network.c. (nielsdos)
1112

1213
- Curl:
1314
. Fixed case when curl_error returns an empty string.

main/network.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
861861
#if HAVE_IPV6 && HAVE_INET_PTON
862862
struct sockaddr_in6 in6;
863863
#endif
864-
} local_address;
864+
} local_address = {0};
865865
int local_address_len = 0;
866866

867867
if (sa->sa_family == AF_INET) {
@@ -873,7 +873,6 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short
873873
local_address_len = sizeof(struct sockaddr_in);
874874
local_address.in4.sin_family = sa->sa_family;
875875
local_address.in4.sin_port = htons(bindport);
876-
memset(&(local_address.in4.sin_zero), 0, sizeof(local_address.in4.sin_zero));
877876
}
878877
}
879878
#if HAVE_IPV6 && HAVE_INET_PTON

0 commit comments

Comments
 (0)