Skip to content

Commit 9b1950b

Browse files
committed
Zero sockaddr struct
in6 has a bunch of extra fields that we're leaving uninitialized. I don't see them locally, but there's valgrind warnings on gcov.
1 parent 9179524 commit 9b1950b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

main/network.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_lo
526526
struct sockaddr_in6 *in6 = (struct sockaddr_in6*)sa;
527527
#endif
528528

529+
memset(sa, 0, sizeof(struct sockaddr));
530+
529531
if (*addr == '[') {
530532
colon = memchr(addr + 1, ']', addrlen-1);
531533
if (!colon || colon[1] != ':') {

0 commit comments

Comments
 (0)