diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-06-05 18:46:41 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-06-05 18:46:41 +0000 |
commit | ff4347e856246613ff7b1ee9b23b5396459d7b09 (patch) | |
tree | a0789fae40e692b6e497162575ccb0bb494cd24f /packet-mdshdr.c | |
parent | ce8465eb90576840c92cb9f00dfd698daad41a9d (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.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7791 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-mdshdr.c')
-rw-r--r-- | packet-mdshdr.c | 15 |
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); |