ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 27 Oct 2009 01:04:47 -0700

On Oct 27, 2009, at 1:01 AM, Josef Frühwirth wrote:

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.

Yes, that's why the example says that - you need the last line there.

Does this last line have a ETX functionality ?

Yes. It's like the '\0' at the end of a C string, or the NULL "next" pointer at the end of a singly-linked list, or like any of a number of other data structures terminated with an end marker.

Shouldn't there be a better way to check the size/end of this data structure!?

"Better" in what sense?  Harder to omit?