svn commit: r319392 - stable/11/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Thu Jun 1 08:04:11 UTC 2017
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);
More information about the svn-src-stable
mailing list