Wireshark mailing list archives

Re: New dissector: variable length of a fields


From: Guy Harris <guy () alum mit edu>
Date: Sun, 16 Feb 2014 12:00:32 -0800


On Feb 15, 2014, at 10:17 PM, Dmitrij K <kdiman () live ru> wrote:

        ...

Binary datas range from 0-*:  <MISSING>
------- Here must be the 'Field magic3: 0x3' but it is not !!! --------
Dissector bug, protocol MYPROTO: proto.c:3566: failed assertion "DISSECTOR_ASSERT_NOT_REACHED"

OK, what you're doing wrong is doing

     proto_tree_add_item(my_tree, hf_hdr_magic3, tvb, offset, -1, FALSE); offset += 1;

rather than

     proto_tree_add_item(my_tree, hf_hdr_magic3, tvb, offset, 1, FALSE); offset += 1;

"magic3" is specified as a 1-byte field, so its length must be 1, not -1.
___________________________________________________________________________
Sent via:    Wireshark-users mailing list <wireshark-users () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-users
Unsubscribe: https://wireshark.org/mailman/options/wireshark-users
             mailto:wireshark-users-request () wireshark org?subject=unsubscribe


Current thread: