diff options
author | guy <guy> | 2004-03-24 03:04:01 +0000 |
---|---|---|
committer | guy <guy> | 2004-03-24 03:04:01 +0000 |
commit | 650537f0ccb4083dd04065c79583826cabf4b3f4 (patch) | |
tree | ceb003fe9839f0c6576fab9c8ec848ef1dfb6868 /print-pppoe.c | |
parent | c37418ccbca77d37d4ef83a836444aff703be33e (diff) | |
download | tcpdump-650537f0ccb4083dd04065c79583826cabf4b3f4.tar.gz |
Improve bounds checking.
Diffstat (limited to 'print-pppoe.c')
-rw-r--r-- | print-pppoe.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/print-pppoe.c b/print-pppoe.c index e5836126..d809082d 100644 --- a/print-pppoe.c +++ b/print-pppoe.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] _U_ = -"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.27 2003-11-16 09:36:33 guy Exp $ (LBL)"; +"@(#) $Header: /tcpdump/master/tcpdump/print-pppoe.c,v 1.28 2004-03-24 03:04:01 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -105,11 +105,7 @@ pppoe_print(register const u_char *bp, u_int length) const u_char *pppoe_packet, *pppoe_payload; pppoe_packet = bp; - if (pppoe_packet > snapend) { - printf("[|pppoe]"); - return (PPPOE_HDRLEN); - } - + TCHECK2(*pppoe_packet, PPPOE_HDRLEN); pppoe_ver = (pppoe_packet[0] & 0xF0) >> 4; pppoe_type = (pppoe_packet[0] & 0x0F); pppoe_code = pppoe_packet[1]; @@ -215,4 +211,8 @@ pppoe_print(register const u_char *bp, u_int length) printf(" "); return (PPPOE_HDRLEN + ppp_print(pppoe_payload, pppoe_length)); } + +trunc: + printf("[|pppoe]"); + return (PPPOE_HDRLEN); } |