diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-11-20 21:59:18 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-11-20 21:59:18 +0000 |
commit | 93bdfea13eb69582c481bcbb5c59cf90f3004144 (patch) | |
tree | ae3c72a5204d6498a7f2957738be88615f89a115 /packet-ppp.c | |
parent | 960baf0e34e0de2c339e051afe1e411bd4595f89 (diff) |
Make the capture routines take an additional argument giving the amount
of packet data captured.
Make the "BYTES_ARE_IN_FRAME()" macro take a "captured length of the
packet" argument.
Add some length checks to capture routines.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4235 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-ppp.c')
-rw-r--r-- | packet-ppp.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/packet-ppp.c b/packet-ppp.c index df46dee135..2497c3986f 100644 --- a/packet-ppp.c +++ b/packet-ppp.c @@ -1,7 +1,7 @@ /* packet-ppp.c * Routines for ppp packet disassembly * - * $Id: packet-ppp.c,v 1.74 2001/11/04 04:50:12 guy Exp $ + * $Id: packet-ppp.c,v 1.75 2001/11/20 21:59:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -952,20 +952,28 @@ fcs32(guint32 fcs, } void -capture_ppp_hdlc( const u_char *pd, int offset, packet_counts *ld ) { +capture_ppp_hdlc( const u_char *pd, int offset, int len, packet_counts *ld ) { + if (!BYTES_ARE_IN_FRAME(offset, len, 2)) { + ld->other++; + return; + } if (pd[0] == CHDLC_ADDR_UNICAST || pd[0] == CHDLC_ADDR_MULTICAST) { - capture_chdlc(pd, offset, ld); + capture_chdlc(pd, offset, len, ld); + return; + } + if (!BYTES_ARE_IN_FRAME(offset, len, 4)) { + ld->other++; return; } switch (pntohs(&pd[offset + 2])) { case PPP_IP: - capture_ip(pd, offset + 4, ld); + capture_ip(pd, offset + 4, len, ld); break; case PPP_IPX: - capture_ipx(pd, offset + 4, ld); + capture_ipx(pd, offset + 4, len, ld); break; case PPP_VINES: - capture_vines(pd, offset + 4, ld); + capture_vines(pd, offset + 4, len, ld); break; default: ld->other++; |