Wireshark mailing list archives

Re: wireshark crash after "Adding Names to the protocol"


From: Guy Harris <guy () alum mit edu>
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?
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: