ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] wireshark crash after "Adding Names to the protocol"

From: Josef Frühwirth <fruehwirth@xxxxxxxxx>
Date: Tue, 27 Oct 2009 09:01:18 +0100
Hi,

using svn revision 30650 I started implementing a dissector.
After adding names to Protocol-Fields
(http://www.wireshark.org/docs/wsdg_html/#id4709795)
wireshark crashed in some cases.

Within Filter-Expression window I navigated to filter names of my
custom dissector.
When wireshark tried to retrieve defined names for a specific field
wireshark crashed.

I found out, that the difference between named fields crashing wireshark and not
were a single line at the end of the data structure containing the
value <-> name relation.

The example says data structure should look like:
static const value_string packettypenames[] = {
	{ 1, "Initialise" },
	{ 2, "Terminate" },
	{ 3, "Data" },
	{ 0, NULL }
};

when  omitting the last line "{ 0, NULL }"
wireshark crashes.

Does this last line have a ETX functionality ?
Shouldn't there be a better way to check the size/end of this data structure!?

thx
Josef