summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/hdlc.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-04-19 09:25:58 +0000
committerphk <phk@FreeBSD.org>1997-04-19 09:25:58 +0000
commit0bbcc047cfe245e46e810cd65056d20bad323398 (patch)
treefb0deaaee85ba0654f57606caba78929cf3c0726 /usr.sbin/ppp/hdlc.c
parentff3a24508f10f21ddf1d84e86dcd633f5febcb19 (diff)
downloadFreeBSD-src-0bbcc047cfe245e46e810cd65056d20bad323398.zip
FreeBSD-src-0bbcc047cfe245e46e810cd65056d20bad323398.tar.gz
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
Diffstat (limited to 'usr.sbin/ppp/hdlc.c')
-rw-r--r--usr.sbin/ppp/hdlc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/ppp/hdlc.c b/usr.sbin/ppp/hdlc.c
index 76c09a3..986da8c 100644
--- a/usr.sbin/ppp/hdlc.c
+++ b/usr.sbin/ppp/hdlc.c
@@ -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++;
OpenPOWER on IntegriCloud