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

From: "news.gmane.com" <AndreasSander1@xxxxxxx>
Date: Wed, 24 Nov 2010 16:08:53 +0100
"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