diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_echo_udp_sendto_recvfrom.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_echo_udp_sendto_recvfrom.c b/tests/test_echo_udp_sendto_recvfrom.c index 7139656..378d38d 100644 --- a/tests/test_echo_udp_sendto_recvfrom.c +++ b/tests/test_echo_udp_sendto_recvfrom.c @@ -54,7 +54,7 @@ static void test_sendto_recvfrom_ipv4(void **state) char send_buf[64] = {0}; char recv_buf[64] = {0}; struct sockaddr_in cli_in; - socklen_t clen; + socklen_t clen = sizeof(cli_in); snprintf(send_buf, sizeof(send_buf), "packet.%d", i); @@ -66,6 +66,8 @@ static void test_sendto_recvfrom_ipv4(void **state) slen); assert_int_not_equal(ret, -1); + ZERO_STRUCT(cli_in); + ret = recvfrom(s, recv_buf, sizeof(recv_buf), @@ -103,7 +105,7 @@ static void test_sendto_recvfrom_ipv6(void **state) char send_buf[64] = {0}; char recv_buf[64] = {0}; struct sockaddr_in6 cli_in6; - socklen_t clen; + socklen_t clen = sizeof(cli_in6); snprintf(send_buf, sizeof(send_buf), "packet.%d", i); @@ -115,6 +117,8 @@ static void test_sendto_recvfrom_ipv6(void **state) slen); assert_int_not_equal(ret, -1); + ZERO_STRUCT(cli_in6); + ret = recvfrom(s, recv_buf, sizeof(recv_buf), |
