Don't scribble on the stack if our input packet is

bigger than our MRU.  Moan and drop the packet
instead.
This commit is contained in:
Brian Somers 1998-01-04 20:26:37 +00:00
parent 79d1bdaedb
commit 512db5555c

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: ip.c,v 1.34 1997/12/28 02:46:22 brian Exp $
* $Id: ip.c,v 1.35 1997/12/29 22:23:11 brian Exp $
*
* TODO:
* o Return ICMP message for filterd packet
@ -396,6 +396,12 @@ IpInput(struct mbuf * bp)
cp = tun.data;
nb = 0;
for (wp = bp; wp; wp = wp->next) { /* Copy to contiguous region */
if (sizeof tun.data - (cp - tun.data) < wp->cnt) {
LogPrintf(LogERROR, "IpInput: Packet too large (%d) - dropped\n",
plength(bp));
pfree(bp);
return;
}
memcpy(cp, MBUF_CTOP(wp), wp->cnt);
cp += wp->cnt;
nb += wp->cnt;