Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jan 2017 10:55:26 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r312063 - head/sys/netinet
Message-ID:  <201701131055.v0DAtQ6X011129@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Fri Jan 13 10:55:26 2017
New Revision: 312063
URL: https://svnweb.freebsd.org/changeset/base/312063

Log:
  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
  MFC after:		1 week
  Differential Revision:	https://reviews.freebsd.org/D9161

Modified:
  head/sys/netinet/raw_ip.c

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c	Fri Jan 13 10:28:26 2017	(r312062)
+++ head/sys/netinet/raw_ip.c	Fri Jan 13 10:55:26 2017	(r312063)
@@ -508,7 +508,7 @@ rip_output(struct mbuf *m, struct socket
 		 * 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?201701131055.v0DAtQ6X011129>