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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to