svn commit: r312063 - head/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Fri Jan 13 10:55:28 UTC 2017


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);


More information about the svn-src-head mailing list