Dear all,
I have a question regarding FT_STRING vs FT_STINGZ. From the
README.developer:
FT_STRING A string of characters, not necessarily
NUL-terminated, but possibly NUL-padded.
This, and the other string-of-characters
types, are to be used for text strings,
not raw binary data.
I want to handle in a dissector a string which is not necessary zero
terminated.
So I'm using the following code:
interface_identifier_length = length - PARAMETER_HEADER_LENGTH;
interface_identifier = (char *)tvb_get_ptr(parameter_tvb,
TEXT_INTERFACE_IDENTIFIER_OFFSET,
interface_identifier_length);
proto_tree_add_string(parameter_tree, hf_text_interface_identifier,
parameter_tvb, TEXT_INTERFACE_IDENTIFIER_OFFSET,
interface_identifier_length ,
interface_identifier);
proto_item_set_text(parameter_item, "Text interface identifier (%.*s)",
interface_identifier_length, interface_identifier);
where hf_text_interface_identifier is defined as
{ &hf_text_interface_identifier,
{ "Text interface identifier", "iua.text_interface_identifier",
FT_STRING, BASE_DEC, NULL, 0x0,
"", HFILL }
},
When I test this stuff with a non zero terminated interface identifier
the proto_item_set_text
works but the proto_tree_add_string does use the length field to
determine the length of the string.
But this is what I expect proto_tree_add_string to do with a FT_STRING
arg.
So is this a bug in proto_tree_add_string?
Best regards
Michael
Michael.Tuexen@xxxxxxxxxxxxxxxxx