Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jun 2017 08:04:10 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r319392 - stable/11/sys/netinet
Message-ID:  <201706010804.v5184Awk014162@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Thu Jun  1 08:04:09 2017
New Revision: 319392
URL: https://svnweb.freebsd.org/changeset/base/319392

Log:
  MFC r312063:
  
  Ensure that the buffer length and the length provided in the IPv4
  header match when using a raw socket to send IPv4 packets and
  providing the header. If they don't match, let send return -1
  and set errno to EINVAL.
  
  Before this patch is was only enforced that the length in the header
  is not larger then the buffer length.
  
  PR:			212283
  Reviewed by:		ae, gnn
  Differential Revision:	https://reviews.freebsd.org/D9161

Modified:
  stable/11/sys/netinet/raw_ip.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/raw_ip.c
==============================================================================
--- stable/11/sys/netinet/raw_ip.c	Thu Jun  1 07:10:40 2017	(r319391)
+++ stable/11/sys/netinet/raw_ip.c	Thu Jun  1 08:04:09 2017	(r319392)
@@ -507,7 +507,7 @@ rip_output(struct mbuf *m, struct socket *so, ...)
 		 * and don't allow packet length sizes that will crash.
 		 */
 		if (((ip->ip_hl != (sizeof (*ip) >> 2)) && inp->inp_options)
-		    || (ntohs(ip->ip_len) > m->m_pkthdr.len)
+		    || (ntohs(ip->ip_len) != m->m_pkthdr.len)
 		    || (ntohs(ip->ip_len) < (ip->ip_hl << 2))) {
 			INP_RUNLOCK(inp);
 			m_freem(m);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706010804.v5184Awk014162>