diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2019-06-13 13:40:37 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-06-13 13:41:39 -0700 |
commit | 9f77b36fa100761eb3eabbb87f5111419202a9d5 (patch) | |
tree | 68515e81e203cb4355fceec4850052fb78aa6c70 /test | |
parent | 94ab253d7edfa359898d73b62a88da62629425c3 (diff) |
Set optlen correctly when calling getsockopt.
PiperOrigin-RevId: 253096085
Diffstat (limited to 'test')
-rw-r--r-- | test/syscalls/linux/socket_ip_tcp_generic.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/syscalls/linux/socket_ip_tcp_generic.cc b/test/syscalls/linux/socket_ip_tcp_generic.cc index 0b76280a7..a43cf9bce 100644 --- a/test/syscalls/linux/socket_ip_tcp_generic.cc +++ b/test/syscalls/linux/socket_ip_tcp_generic.cc @@ -679,7 +679,7 @@ TEST_P(TCPSocketPairTest, SetCongestionControlFailsForUnsupported) { auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair()); char old_cc[kTcpCaNameMax]; - socklen_t optlen; + socklen_t optlen = sizeof(old_cc); ASSERT_THAT(getsockopt(sockets->first_fd(), IPPROTO_TCP, TCP_CONGESTION, &old_cc, &optlen), SyscallSucceedsWithValue(0)); @@ -690,6 +690,7 @@ TEST_P(TCPSocketPairTest, SetCongestionControlFailsForUnsupported) { SyscallFailsWithErrno(ENOENT)); char got_cc[kTcpCaNameMax]; + optlen = sizeof(got_cc); ASSERT_THAT(getsockopt(sockets->first_fd(), IPPROTO_TCP, TCP_CONGESTION, &got_cc, &optlen), SyscallSucceedsWithValue(0)); |