This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: strlen on a NULL
- To: Carsten dot Roedel at rt dot bosch dot de (Carsten Roedel K8/DIC2 Tel. 4276)
- Subject: Re: strlen on a NULL
- From: Guy Gascoigne - Piggford <ggp at informix dot com>
- Date: Wed, 13 May 1998 11:19:41 -0700
- Cc: gnu-win32 at cygnus dot com
At 08:14 AM 5/13/98 +0200, you wrote:
>I discovered the same behaviour, on most UNIX systems you'll receive a
>Signal (Bus Error e.g.). Better check all vectors before doing something
>with them, like 'strlen'. By the way, in 'free' it's getting worse,
>because you must also check not for pointing to a 'Zero', this causes a
crash.
void * p = 0;
free(p);
This is completely valid (though somewhat contrived), and defined to be
safe by the ANSI C standard. However all of the mem... and str... require
valid, readable (and for many functions, writable) pointers. On NT and a
fair number of Unixs 0 is not readable or writable.
Guy
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".