Wireshark-bugs: [Wireshark-bugs] [Bug 1957] New Dissector: EPCglobal Low-Level Reader Protocol
Date: Fri, 4 Jun 2010 17:31:15 -0700 (PDT)

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

    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,
             tvb_offset-bytelength, bytelength, string);

...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);

...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);

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

Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.