https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1957
Gerald Combs <gerald@xxxxxxxxxxxxx> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
--- Comment #27 from Gerald Combs <gerald@xxxxxxxxxxxxx> 2010-06-04 17:31:12 PDT ---
I really hate to do this, but I'm backing out the commit for now. It looks like
you're grabbing a data pointer using tvb_get_ptr in llrp_ws_StreamRead, then
using that pointer to add items to the tree further down in the dissector. For
example,
case LLRP_FIELDTYPE_utf8v:
{
char *string;
string= (char *) malloc(bytelength+3);
if(string!= NULL)
{
memcpy(string+1, data, bytelength);
string[0]= '"';
string[bytelength+1]= '"';
string[bytelength+2]= '\0';
proto_tree_add_string(tree, hf_llrp_field_value_variable,
info->tvb,
tvb_offset-bytelength, bytelength, string);
free(string);
}
break;
}
...should probably look like...
case LLRP_FIELDTYPE_utf8v:
{
emem_strbuf_t *string = ep_strbuf_new("");
ep_strbuf_printf("\"%s\"", tvb_format_text(info->tvb,
tvb_offset-bytelength, bytelength));
proto_tree_add_string(tree, hf_llrp_field_value_variable, info->tvb,
tvb_offset-bytelength, bytelength, string->str);
break;
}
...or if you don't care about having quotes around your string,
case LLRP_FIELDTYPE_utf8v:
{
proto_tree_add_item(tree, hf_llrp_field_value_variable, info->tvb,
tvb_offset-bytelength, bytelength, FALSE);
break;
}
There shouldn't be any reason to use the "data" parameter in
llrp_ws_HandleField at all. You should either user proto_tree_add_item or
use info->tvb to get the data using normal accessors.
Also, the dissector is failing checkapi due to the use of sprintf, malloc, and
free.
--
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.