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] [Wireshark-commits] rev 27948: /trunk/epan/ /trunk/epan/: em

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Fri, 03 Apr 2009 14:13:19 -0400


Guy Harris wrote:
On Apr 3, 2009, at 10:32 AM, jmayer@xxxxxxxxxxxxx wrote:

Don't crash on linux:
strlen(NULL) isn't an acceptable call.

I'd be somewhat surprised if there's a platform out there on which we run where strlen(NULL) *doesn't* crash; on most if not all platforms on which we run:

	1) NULL has all of its bits zero;

2) at least one page of address space starting at 0 is deliberately missing (to catch null-pointer dereferences);

and I suspect most if not all implementations of strlen() don't explicitly check for a null argument.

I have this vague recollection of some platform not minding being handed NULL pointers to strings; I think it caused me some grief while porting to Solaris. HPUX maybe?