From 8f00e4f16cf85c50b2b5d75ef62d64a699603bbe Mon Sep 17 00:00:00 2001 From: Mike Belopuhov Date: Thu, 20 Jun 2013 20:21:21 +0000 Subject: Always make sure that the temporary TCP protocol control block structure is zeroed out before use. From David Hill ; ok blambert claudio henning --- sys/netinet/tcp_input.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 825ea996b62..7ab5da190dc 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.263 2013/06/09 22:03:06 yasuoka Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.264 2013/06/20 20:21:20 mikeb Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -4020,12 +4020,12 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, if (win > TCP_MAXWIN) win = TCP_MAXWIN; + bzero(&tb, sizeof(tb)); #ifdef TCP_SIGNATURE if (optp || (tp->t_flags & TF_SIGNATURE)) { #else if (optp) { #endif - bzero(&tb, sizeof(tb)); tb.pf = tp->pf; #ifdef TCP_SACK tb.sack_enable = tp->sack_enable; @@ -4039,8 +4039,7 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, if (tcp_dooptions(&tb, optp, optlen, th, m, iphlen, oi, sotoinpcb(so)->inp_rtableid)) return (-1); - } else - tb.t_flags = 0; + } switch (src->sa_family) { #ifdef INET -- cgit v1.2.3