pullup to sizeof struct ip before sending to ip_output.

Suggested by:	ru
This commit is contained in:
Gleb Smirnoff 2005-02-11 21:26:39 +00:00
parent 029f08c23c
commit 0a1a279e93

View File

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