delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/14/06:09:02

From: ggp AT informix DOT com (Guy Gascoigne - Piggford)
Subject: Re: strlen on a NULL
14 May 1998 06:09:02 -0700 :
Message-ID: <3.0.3.32.19980513111941.00a4b550.cygnus.gnu-win32@pop.pdx.informix.com>
References: <199805130614 DOT IAA05154 AT dic DOT k8 DOT rt DOT bosch DOT de>
Mime-Version: 1.0
To: Carsten DOT Roedel AT rt DOT bosch DOT de (Carsten Roedel K8/DIC2 Tel. 4276)
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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019