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] VALS macro causing Wireshark to crash on Windows

From: "Chih Wang" <CWang@xxxxxxxxxxxxxx>
Date: Wed, 6 Aug 2008 16:22:32 -0700
Thank you, Guy. That was it.

When I followed the tutorial, I didn't realize value_string must be
terminated by an end-of-line entry. I thought it was just another valid
entry in the example.


-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx
[mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of Guy Harris
Sent: Wednesday, August 06, 2008 4:11 PM
To: Developer support list for Wireshark
Subject: Re: [Wireshark-dev] VALS macro causing Wireshark to crash on
Windows


On Aug 6, 2008, at 4:00 PM, Chih Wang wrote:

> 	static const value_string msgtypenames[] = {
> 	  { 0x10, "Type 16" },
> 	  { 0x01, "Type 1" },
> 	  { 0x03, "Type 3" },
> 	  { 0x05, "Type 5"}
> 	};

A value_string array *must* be terminated with an end-of-list entry:

	static const value_string msgtypenames[] = {
	  { 0x10, "Type 16" },
	  { 0x01, "Type 1" },
	  { 0x03, "Type 3" },
	  { 0x05, "Type 5"},
	  { 0, NULL }
	};

Otherwise, code in Wireshark might run past the end of the array and  
refer to data that's not part of the array as if it were part of the  
array, which can, for example, cause non-pointer data to be  
dereferenced as if it were a pointer.

There's nothing Windows-specific about that; if it worked on some  
other operating system, that was purely by luck.
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
https://wireshark.org/mailman/listinfo/wireshark-dev


CONFIDENTIALITY NOTICE: The information contained in this message may be privileged and/or confidential. If you are not the intended recipient, or responsible for delivering this message to the intended recipient, any review, forwarding, dissemination, distribution or copying of this communication or any attachment(s) is strictly prohibited. If you have received this message in error, please notify the sender immediately, and delete it and all attachments from your computer and network.