Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Segmentation Fault in Simple Dissector-Plugin

From: Patrick Nowak <student.nowak@xxxxxxxxxx>
Date: Thu, 25 Nov 2010 08:40:11 +0100
Hi,

this morning I compared my code once again to the example-code from http://www.wireshark.org/docs/wsdg_html_chunked/ChDissectAdd.html#ChDissectDetails and it is exactly the same, except the ne protocol-name(which is correct in my code here. the code pasted into the email had a small renaming-error, I simply forgot to rename proto_slapml).

You say that the problem might come from the function proto_tree_add_item because I did not pass a proto_register_field_array. But according to the debugger, the program does not run up to this point. I always stops at the first line in my dissect_testdissect()-method, which is *col_set_str(pinfo->cinfo, COL_PROTOCOL, "TestDissect");*. According to the debugger, this assertion fails: *g_assert(cinfo->col_first[el] >= 0);*.

This tells me, that something in cinfo must have changed since the first time the dissect_testdissect()-method was called(which functions perfectly and the protocol-column is set to my custom protocol name "TestDissect").

I will continue with the Developers Guide and look further into adding the hf_array. But I would appreciate any thought on my problem since it states cleary in the Developers Guide, that I should see a tree item in the Details section with the code i already have(see text after Example 9.4 from my link above).

Regards,
Patrick

news.gmane.com schrieb:
"Patrick Nowak" <student.nowak@xxxxxxxxxx> wrote in message news:4CECF80A.8040507@xxxxxxxxxx...
Hello,

I am fairly new to developing Dissectors for Wireshark. I started with
the small sample from the Wireshark Developers Guide and changed a few
things(Strings and Port).

My Plugin looks like this:

Your code does not compile.

1. proto_slapml is not defined. You pass the return value of proto_register_protocol to this variable.

2. proto_testdissect is -1 and can cause this exception, when you pass this to proto_tree_add_item.

3. The function proto_tree_add_item does not expect a return value from proto_register_protocol but a hf index created by proto_register_field_array.
see prototype:
proto_tree *proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
    gint start, gint length, gboolean little_endian);


Andy



___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe