From be8c6c16f8b548003f53fcb7a1e52e56f24cdb8d Mon Sep 17 00:00:00 2001 From: Gilbert Ramirez Date: Wed, 15 Sep 1999 06:26:42 +0000 Subject: Handle short packets in the capture and dissect stages more intelligently. svn path=/trunk/; revision=680 --- packet-eth.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'packet-eth.c') diff --git a/packet-eth.c b/packet-eth.c index 4f24e42d51..f819a5c583 100644 --- a/packet-eth.c +++ b/packet-eth.c @@ -1,7 +1,7 @@ /* packet-eth.c * Routines for ethernet packet disassembly * - * $Id: packet-eth.c,v 1.18 1999/08/24 06:10:05 guy Exp $ + * $Id: packet-eth.c,v 1.19 1999/09/15 06:26:42 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -66,6 +66,11 @@ capture_eth(const u_char *pd, guint32 cap_len, packet_counts *ld) { guint16 etype; int offset = ETH_HEADER_SIZE; int ethhdr_type; /* the type of ethernet frame */ + + if (cap_len < ETH_HEADER_SIZE) { + ld->other++; + return; + } etype = (pd[12] << 8) | pd[13]; @@ -107,6 +112,11 @@ dissect_eth(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree *fh_tree = NULL; proto_item *ti; int ethhdr_type; /* the type of ethernet frame */ + + if (fd->cap_len < ETH_HEADER_SIZE) { + dissect_data(pd, offset, fd, tree); + return; + } if (check_col(fd, COL_RES_DL_DST)) col_add_str(fd, COL_RES_DL_DST, get_ether_name((u_char *)&pd[offset+0])); -- cgit v1.2.3