Skip to content

Commit

Permalink
Zero sockaddr struct
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nikic committed Apr 15, 2019
1 parent 9179524 commit 9b1950b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_lo
struct sockaddr_in6 *in6 = (struct sockaddr_in6*)sa;
#endif

memset(sa, 0, sizeof(struct sockaddr));

if (*addr == '[') {
colon = memchr(addr + 1, ']', addrlen-1);
if (!colon || colon[1] != ':') {
Expand Down

0 comments on commit 9b1950b

Please sign in to comment.