aboutsummaryrefslogtreecommitdiffstats
path: root/packet-mdshdr.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-06-05 18:46:41 +0000
committerGuy Harris <guy@alum.mit.edu>2003-06-05 18:46:41 +0000
commit1aa63490c7963c43a2f84ee1f58f2122f1e3da96 (patch)
treea0789fae40e692b6e497162575ccb0bb494cd24f /packet-mdshdr.c
parentc00038711d11d44b02fdd4f4cb613e2cece6071c (diff)
From Motonori Shindo: use "val_to_str()" and "sof_vals"/"eof_vals"
rather than a separate indexed table of strings, to avoid crashes with bad packets. svn path=/trunk/; revision=7791
Diffstat (limited to 'packet-mdshdr.c')
-rw-r--r--packet-mdshdr.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/packet-mdshdr.c b/packet-mdshdr.c
index 80d6ad32be..a37839f7ac 100644
--- a/packet-mdshdr.c
+++ b/packet-mdshdr.c
@@ -2,7 +2,7 @@
* Routines for dissection of Cisco MDS Switch Internal Header
* Copyright 2001, Dinesh G Dutt <ddutt@andiamo.com>
*
- * $Id: packet-mdshdr.c,v 1.4 2003/03/05 07:41:23 guy Exp $
+ * $Id: packet-mdshdr.c,v 1.5 2003/06/05 18:46:41 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -150,16 +150,6 @@ static const value_string eof_vals[] = {
{0, NULL},
};
-static const gchar * sof_strings[] = {
- "Null", "SOFc1", "SOFi1", "SOFn1", "SOFi2", "SOFn2", "SOFi3", "SOFn3",
- "SOFf", "SOFc4", "SOFi4", "SOFn4",
-};
-
-static const gchar *eof_strings[] = {
- "Null", "EOFt", "EOFdt", "EOFn", "EOFa", "", "EOFdti", "EOFni",
- "", "", "EOFrt", "", "", "", "EOFrti",
-};
-
/* Code to actually dissect the packets */
static void
dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -212,7 +202,8 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ti_main = proto_tree_add_protocol_format (tree, proto_mdshdr, tvb, 0,
MDSHDR_HEADER_SIZE+pktlen,
"MDS Header(%s/%s)",
- sof_strings[sof], eof_strings[eof]);
+ val_to_str(sof, sof_vals, "Unknown(%u)"),
+ val_to_str(eof, eof_vals, "Unknown(%u)"));
mdshdr_tree_main = proto_item_add_subtree (ti_main, ett_mdshdr);