From fd0e521cbb453015cf1b0022b4138597c038c3cf Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Wed, 12 Jan 2011 03:19:07 +0000 Subject: There's no need to pass the result of tvb_get_ptr() as the 'value' in proto_tree_add_string(): just use proto_tree_add_item(). Replace some tvb_get_ptr()s with tvb_get_ephemeral_string()s. In a couple of places an hf variable was being used as the length in a call to proto_tree_add_*(). Use the appropriate variable instead. svn path=/trunk/; revision=35495 --- epan/dissectors/packet-dcerpc-fileexp.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'epan/dissectors') diff --git a/epan/dissectors/packet-dcerpc-fileexp.c b/epan/dissectors/packet-dcerpc-fileexp.c index 01330dc824..cd31317ad3 100644 --- a/epan/dissectors/packet-dcerpc-fileexp.c +++ b/epan/dissectors/packet-dcerpc-fileexp.c @@ -603,10 +603,8 @@ typedef [string] byte NameString_t[AFS_NAMEMAX]; col_append_fstr (pinfo->cinfo, COL_INFO, " String_size:%u", string_size); if (string_size < AFS_NAMEMAX) { -/* proto_tree_add_string(tree, id, tvb, start, length, value_ptr); */ - - proto_tree_add_string (tree, hf_fileexp_afsNameString_t_principalName_string, tvb, offset, string_size, tvb_get_ptr (tvb, offset, string_size)); - namestring = tvb_get_ptr (tvb, offset, string_size); + proto_tree_add_item (tree, hf_fileexp_afsNameString_t_principalName_string, tvb, offset, string_size, ENC_NA); + namestring = tvb_get_ephemeral_string (tvb, offset, string_size); offset += string_size; if (check_col (pinfo->cinfo, COL_INFO)) col_append_fstr (pinfo->cinfo, COL_INFO, " Principal:%s", namestring); @@ -793,11 +791,9 @@ dissect_afsTaggedPath (tvbuff_t * tvb, int offset, offset = dissect_ndr_uint16 (tvb, offset, pinfo, tree, drep, hf_fileexp_afsTaggedPath_tp_length, &tp_length); - proto_tree_add_string (tree, hf_fileexp_afsTaggedPath_tp_chars, tvb, offset, - hf_fileexp_afsTaggedPath_tp_length, tvb_get_ptr (tvb, - offset, - tp_length)); - tp_chars = tvb_get_ptr (tvb, offset, 1025); + proto_tree_add_item (tree, hf_fileexp_afsTaggedPath_tp_chars, tvb, offset, + tp_length, ENC_NA); + tp_chars = tvb_get_ephemeral_string (tvb, offset, 1025); offset += 1025; if (check_col (pinfo->cinfo, COL_INFO)) col_append_fstr (pinfo->cinfo, COL_INFO, " :tp_chars %s", tp_chars); @@ -1375,10 +1371,9 @@ dissect_afstaggedname (tvbuff_t * tvb, int offset, &tn_length); if (tn_length < 254) { - proto_tree_add_string (tree, hf_fileexp_tn_string, tvb, offset, - hf_fileexp_tn_size, tvb_get_ptr (tvb, offset, - tn_length)); - tn_string = tvb_get_ptr (tvb, offset, 257); + proto_tree_add_item (tree, hf_fileexp_tn_string, tvb, offset, + tn_length, ENC_NA); + tn_string = tvb_get_ephemeral_string (tvb, offset, 257); offset += 257; if (check_col (pinfo->cinfo, COL_INFO)) col_append_fstr (pinfo->cinfo, COL_INFO, " :tn_tag: %s", tn_string); -- cgit v1.2.3