diff options
Diffstat (limited to 'sys/netgraph/ng_ipfw.c')
-rw-r--r-- | sys/netgraph/ng_ipfw.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/netgraph/ng_ipfw.c b/sys/netgraph/ng_ipfw.c index e7325dc..2fab936 100644 --- a/sys/netgraph/ng_ipfw.c +++ b/sys/netgraph/ng_ipfw.c @@ -229,7 +229,13 @@ ng_ipfw_rcvdata(hook_p hook, item_p item) switch (ngit->dir) { case NG_IPFW_OUT: { - struct ip *ip = mtod(m, struct ip *); + struct ip *ip; + + if (m->m_len < sizeof (struct ip) && + (m = m_pullup(m, sizeof (struct ip))) == NULL) + return(EINVAL); + + ip = mtod(m, struct ip *); ip->ip_len = ntohs(ip->ip_len); ip->ip_off = ntohs(ip->ip_off); |