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
This commit is contained in:
Guy Harris 2004-01-13 21:49:52 +00:00
parent 053ec89a5d
commit 6c01a97497
2 changed files with 20 additions and 14 deletions

View File

@ -2,7 +2,7 @@
* Routines for AppleTalk packet disassembly: LLAP, DDP, NBP, ATP, ASP,
* RTMP.
*
* $Id: packet-atalk.c,v 1.93 2004/01/06 02:20:32 guy Exp $
* $Id: packet-atalk.c,v 1.94 2004/01/13 21:49:52 guy Exp $
*
* Simon Wilkinson <sxw@dcs.ed.ac.uk>
*
@ -986,8 +986,9 @@ dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
ofs++;
sub_tree = proto_item_add_subtree(ti, ett_asp_vers);
for (i = 0; i < nbe; i++) {
ti = proto_tree_add_item(sub_tree, hf_asp_server_vers, tvb, ofs, 1, FALSE);
ofs += ti->finfo->length;
len = tvb_get_guint8(tvb, ofs);
proto_tree_add_item(sub_tree, hf_asp_server_vers, tvb, ofs, 1, FALSE);
ofs += len + 1;
}
}
@ -998,8 +999,9 @@ dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
ofs++;
sub_tree = proto_item_add_subtree(ti, ett_asp_uams);
for (i = 0; i < nbe; i++) {
ti = proto_tree_add_item(sub_tree, hf_asp_server_uams, tvb, ofs, 1, FALSE);
ofs += ti->finfo->length;
len = tvb_get_guint8(tvb, ofs);
proto_tree_add_item(sub_tree, hf_asp_server_uams, tvb, ofs, 1, FALSE);
ofs += len + 1;
}
}
@ -1083,8 +1085,9 @@ dissect_asp_reply_get_status(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
ofs++;
sub_tree = proto_item_add_subtree(ti, ett_asp_directory);
for (i = 0; i < nbe; i++) {
ti = proto_tree_add_item(sub_tree, hf_asp_server_directory, tvb, ofs, 1, FALSE);
ofs += ti->finfo->length;
len = tvb_get_guint8(tvb, ofs);
proto_tree_add_item(sub_tree, hf_asp_server_directory, tvb, ofs, 1, FALSE);
ofs += len + 1;
}
}
if (utf_ofs) {

View File

@ -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) {