diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/address.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/address.c b/src/common/address.c index a47b1228f9..1abd1a7dfb 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -68,6 +68,8 @@ tor_addr_to_sockaddr(const tor_addr_t *a, if (len < (int)sizeof(struct sockaddr_in)) return -1; sin = (struct sockaddr_in *)sa_out; + memset(sin, 0, sizeof(struct sockaddr_in)); + sin->sin_len = sizeof(struct sockaddr_in); sin->sin_family = AF_INET; sin->sin_port = htons(port); sin->sin_addr.s_addr = tor_addr_to_ipv4n(a); @@ -78,6 +80,7 @@ tor_addr_to_sockaddr(const tor_addr_t *a, return -1; sin6 = (struct sockaddr_in6 *)sa_out; memset(sin6, 0, sizeof(struct sockaddr_in6)); + sin6->sin6_len = sizeof(struct sockaddr_in6); sin6->sin6_family = AF_INET6; sin6->sin6_port = htons(port); memcpy(&sin6->sin6_addr, tor_addr_to_in6(a), sizeof(struct in6_addr)); |