From owner-svn-src-head@FreeBSD.ORG Sun Jun 24 22:22:45 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A7961065674; Sun, 24 Jun 2012 22:22:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0BEA78FC17; Sun, 24 Jun 2012 22:22:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5OMMilm034616; Sun, 24 Jun 2012 22:22:44 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5OMMigF034614; Sun, 24 Jun 2012 22:22:44 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201206242222.q5OMMigF034614@svn.freebsd.org> From: Michael Tuexen Date: Sun, 24 Jun 2012 22:22:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237541 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 22:22:45 -0000 Author: tuexen Date: Sun Jun 24 22:22:44 2012 New Revision: 237541 URL: http://svn.freebsd.org/changeset/base/237541 Log: Remove redundant check. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Jun 24 21:25:54 2012 (r237540) +++ head/sys/netinet/sctp_input.c Sun Jun 24 22:22:44 2012 (r237541) @@ -2392,7 +2392,7 @@ sctp_handle_cookie_echo(struct mbuf *m, uint8_t calc_sig[SCTP_SIGNATURE_SIZE], tmp_sig[SCTP_SIGNATURE_SIZE]; uint8_t *sig; uint8_t cookie_ok = 0; - unsigned int size_of_pkt, sig_offset, cookie_offset; + unsigned int sig_offset, cookie_offset; unsigned int cookie_len; struct timeval now; struct timeval time_expires; @@ -2434,7 +2434,6 @@ sctp_handle_cookie_echo(struct mbuf *m, lsin->sin_len = sizeof(*lsin); lsin->sin_port = sh->dest_port; lsin->sin_addr.s_addr = iph->ip_dst.s_addr; - size_of_pkt = SCTP_GET_IPV4_LENGTH(iph); break; } #endif @@ -2452,7 +2451,6 @@ sctp_handle_cookie_echo(struct mbuf *m, ip6 = mtod(m, struct ip6_hdr *); lsin6->sin6_port = sh->dest_port; lsin6->sin6_addr = ip6->ip6_dst; - size_of_pkt = SCTP_GET_IPV6_LENGTH(ip6) + iphlen; break; } #endif @@ -2476,11 +2474,10 @@ sctp_handle_cookie_echo(struct mbuf *m, */ return (NULL); } - if (cookie_len > size_of_pkt || - cookie_len < sizeof(struct sctp_cookie_echo_chunk) + + if (cookie_len < sizeof(struct sctp_cookie_echo_chunk) + sizeof(struct sctp_init_chunk) + sizeof(struct sctp_init_ack_chunk) + SCTP_SIGNATURE_SIZE) { - /* cookie too long! or too small */ + /* cookie too small */ return (NULL); } /* @@ -2488,11 +2485,6 @@ sctp_handle_cookie_echo(struct mbuf *m, * calculated in the sctp_hmac_m() call). */ sig_offset = offset + cookie_len - SCTP_SIGNATURE_SIZE; - if (sig_offset > size_of_pkt) { - /* packet not correct size! */ - /* XXX this may already be accounted for earlier... */ - return (NULL); - } m_sig = m_split(m, sig_offset, M_DONTWAIT); if (m_sig == NULL) { /* out of memory or ?? */