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?