DragonFlyBSD Kernel Audit
DF-0344 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -633,6 +633,12 @@
 	if (m == NULL)	/* consumed by filter */
 		return;
 	ip = mtod(m, struct ip *);
+	if (m->m_len < sizeof(struct ip)) {
+		m = m_pullup(m, sizeof(struct ip));
+		if (m == NULL)
+			return;
+		ip = mtod(m, struct ip *);
+	}
 	hlen = IP_VHL_HL(ip->ip_vhl) << 2;
 	using_srcrt = (odst.s_addr != ip->ip_dst.s_addr);