Handle short packets in the capture and dissect stages more intelligently.

svn path=/trunk/; revision=680
This commit is contained in:
Gilbert Ramirez 1999-09-15 06:26:42 +00:00
parent bcf4001ef0
commit be8c6c16f8
2 changed files with 25 additions and 3 deletions

View File

@ -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 <gerald@zing.org>
@ -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]));

View File

@ -2,7 +2,7 @@
* Routines for Token-Ring packet disassembly
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
*
* $Id: packet-tr.c,v 1.25 1999/09/15 06:13:20 gram Exp $
* $Id: packet-tr.c,v 1.26 1999/09/15 06:26:42 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@ -55,7 +55,9 @@ static int hf_tr_direction = -1;
static int hf_tr_rif = -1;
static int hf_tr_rif_ring = -1;
static int hf_tr_rif_bridge = -1;
#define TR_MAX_HEADER_LEN 32
static const value_string ac_vals[] = {
{ 0, "Token" },
{ 0x10, "Frame" },
@ -159,6 +161,11 @@ capture_tr(const u_char *pd, guint32 cap_len, packet_counts *ld) {
guint8 trn_fc; /* field control field */
guint8 trn_shost[6]; /* source host */
if (cap_len < TR_MAX_HEADER_LEN) {
ld->other++;
return;
}
if ((x = check_for_old_linux(pd)))
{
/* Actually packet starts x bytes into what we have got but with all
@ -287,6 +294,11 @@ dissect_tr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
/* Token-Ring Strings */
char *fc[] = { "MAC", "LLC", "Reserved", "Unknown" };
if (fd->cap_len < TR_MAX_HEADER_LEN) {
dissect_data(pd, offset, fd, tree);
return;
}
if ((x = check_for_old_linux(pd)))
{
/* Actually packet starts x bytes into what we have got but with all