Unceremoneously discard HDLC frames with less than two bytes in them.

XXX: real fix: this could should check the number of bytes in the packet
before accessing them.

Found by: phkmalloc
This commit is contained in:
Poul-Henning Kamp 1997-04-19 09:25:58 +00:00
parent 748c4cdf38
commit 6b5f0ac2a3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25019

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
* $Id: hdlc.c,v 1.11 1997/02/22 16:10:16 peter Exp $
*
* TODO:
*/
@ -334,6 +334,12 @@ HdlcInput(struct mbuf *bp)
}
if (!DEV_IS_SYNC)
bp->cnt -= 2; /* discard FCS part */
if (bp->cnt < 2) { /* XXX: raise this bar ? */
bfree(bp);
return;
}
cp = MBUF_CTOP(bp);
ifInPackets++;