aboutsummaryrefslogtreecommitdiffstats
path: root/packet-chdlc.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-chdlc.c
parent62490b8fdb16d066581c40405cb0d8484248fb09 (diff)
downloadwireshark-e8d4f4f0ac7481c316b3e25a41b1cc747440220e.tar.gz
wireshark-e8d4f4f0ac7481c316b3e25a41b1cc747440220e.tar.bz2
wireshark-e8d4f4f0ac7481c316b3e25a41b1cc747440220e.zip
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-chdlc.c')
-rw-r--r--packet-chdlc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/packet-chdlc.c b/packet-chdlc.c
index 12d4ca84ae..5989980f90 100644
--- a/packet-chdlc.c
+++ b/packet-chdlc.c
@@ -1,10 +1,11 @@
/* packet-chdlc.c
* Routines for Cisco HDLC packet disassembly
*
- * $Id: packet-chdlc.c,v 1.4 2001/06/18 02:17:45 guy Exp $
+ * $Id: packet-chdlc.c,v 1.5 2001/11/20 21:59:12 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -99,10 +100,14 @@ const value_string chdlc_vals[] = {
};
void
-capture_chdlc( const u_char *pd, int offset, packet_counts *ld ) {
+capture_chdlc( const u_char *pd, int offset, int len, packet_counts *ld ) {
+ if (!BYTES_ARE_IN_FRAME(offset, len, 2)) {
+ ld->other++;
+ return;
+ }
switch (pntohs(&pd[offset + 2])) {
case ETHERTYPE_IP:
- capture_ip(pd, offset + 4, ld);
+ capture_ip(pd, offset + 4, len, ld);
break;
default:
ld->other++;