aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ppp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-11-20 21:59:18 +0000
committerGuy Harris <guy@alum.mit.edu>2001-11-20 21:59:18 +0000
commite8d4f4f0ac7481c316b3e25a41b1cc747440220e (patch)
treeae3c72a5204d6498a7f2957738be88615f89a115 /packet-ppp.c
parent62490b8fdb16d066581c40405cb0d8484248fb09 (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. svn path=/trunk/; revision=4235
Diffstat (limited to 'packet-ppp.c')
-rw-r--r--packet-ppp.c20
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++;