Memset before setting length
@ -188,8 +188,8 @@ void extract_opt_stats_from_cmsg(ConnectionMetrics* metrics,
}
static int get_socket_tcp_info(grpc_core::tcp_info* info, int fd) {
info->length = sizeof(*info) - sizeof(socklen_t);
memset(info, 0, sizeof(*info));
return getsockopt(fd, IPPROTO_TCP, TCP_INFO, info, &(info->length));
} /* namespace */
@ -66,6 +66,7 @@ static void TestVerifierCalledOnAckVerifier(void* arg,
GPR_ASSERT(ts->acked_time.time.clock_type == GPR_CLOCK_REALTIME);
GPR_ASSERT(ts->acked_time.time.tv_sec == 123);
GPR_ASSERT(ts->acked_time.time.tv_nsec == 456);
GPR_ASSERT(ts->info.length > 0);
gpr_atm* done = reinterpret_cast<gpr_atm*>(arg);
gpr_atm_rel_store(done, static_cast<gpr_atm>(1));