aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tr.c
diff options
context:
space:
mode:
authorgram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>1999-09-15 06:26:42 +0000
committergram <gram@f5534014-38df-0310-8fa8-9805f1628bb7>1999-09-15 06:26:42 +0000
commit837169f489133541db1b4999f4dfc2a0a09c423e (patch)
tree447264b3d03711439091fc789a93694bf1497a3b /packet-tr.c
parent47bcbe4fff0c1e661258b3b60273a6eefc266ea9 (diff)
Handle short packets in the capture and dissect stages more intelligently.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@680 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-tr.c')
-rw-r--r--packet-tr.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/packet-tr.c b/packet-tr.c
index 1364bffe25..277595a878 100644
--- a/packet-tr.c
+++ b/packet-tr.c
@@ -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