diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-01-13 21:49:52 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-01-13 21:49:52 +0000 |
commit | 6c01a97497e2ce65b4783661d8466a86832a8cdb (patch) | |
tree | 4c5d457230800c40e9f816fb8845c3429f4873b9 /packet-dsi.c | |
parent | 053ec89a5da1f015964dc84040f887b76ce0b53f (diff) | |
download | wireshark-6c01a97497e2ce65b4783661d8466a86832a8cdb.tar.gz wireshark-6c01a97497e2ce65b4783661d8466a86832a8cdb.tar.bz2 wireshark-6c01a97497e2ce65b4783661d8466a86832a8cdb.zip |
You can't rely on "proto_tree_add_item()" returning a non-null pointer,
so you can't rely on getting the length of an FT_UINT_STRING item by
calling "proto_tree_add_item()" and fetching the item length from the
item. Get the length of the string explicitly, and advance the offset
by the length of the string plus the length of the length field.
svn path=/trunk/; revision=9658
Diffstat (limited to 'packet-dsi.c')
-rw-r--r-- | packet-dsi.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/packet-dsi.c b/packet-dsi.c index 3998d67950..1bde823c08 100644 --- a/packet-dsi.c +++ b/packet-dsi.c @@ -2,7 +2,7 @@ * Routines for dsi packet dissection * Copyright 2001, Randy McEoin <rmceoin@pe.com> * - * $Id: packet-dsi.c,v 1.28 2004/01/06 02:20:32 guy Exp $ + * $Id: packet-dsi.c,v 1.29 2004/01/13 21:49:52 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -341,8 +341,9 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset) ofs++; sub_tree = proto_item_add_subtree(ti, ett_dsi_vers); for (i = 0; i < nbe; i++) { - ti = proto_tree_add_item(sub_tree, hf_dsi_server_vers, tvb, ofs, 1, FALSE); - ofs += ti->finfo->length; + len = tvb_get_guint8(tvb, ofs); + proto_tree_add_item(sub_tree, hf_dsi_server_vers, tvb, ofs, 1, FALSE); + ofs += len + 1; } } @@ -353,8 +354,9 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset) ofs++; sub_tree = proto_item_add_subtree(ti, ett_dsi_uams); for (i = 0; i < nbe; i++) { - ti = proto_tree_add_item(sub_tree, hf_dsi_server_uams, tvb, ofs, 1, FALSE); - ofs += ti->finfo->length; + len = tvb_get_guint8(tvb, ofs); + proto_tree_add_item(sub_tree, hf_dsi_server_uams, tvb, ofs, 1, FALSE); + ofs += len + 1; } } @@ -438,8 +440,9 @@ dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset) ofs++; sub_tree = proto_item_add_subtree(ti, ett_dsi_directory); for (i = 0; i < nbe; i++) { - ti = proto_tree_add_item(sub_tree, hf_dsi_server_directory, tvb, ofs, 1, FALSE); - ofs += ti->finfo->length; + len = tvb_get_guint8(tvb, ofs); + proto_tree_add_item(sub_tree, hf_dsi_server_directory, tvb, ofs, 1, FALSE); + ofs += len + 1; } } if (utf_ofs) { |