Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Oct 2009 10:07:18 -0500
From:      David Kelly <dkelly@hiwaay.net>
To:        FreeBSD-Questions@FreeBSD.org
Subject:   Re: need C help, passing char buffer[] by-value....
Message-ID:  <20091020150718.GA42322@Grumpy.DynDNS.org>
In-Reply-To: <20091020050840.e452d7c1.freebsd@edvax.de>
References:  <20091019013337.GA9522@thought.org> <72213BBF-5E05-430D-BF9A-FCD2666951C6@hiwaay.net> <20091019054344.bb4822ca.freebsd@edvax.de> <20091019135805.GA35875@Grumpy.DynDNS.org> <20091020050840.e452d7c1.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 20, 2009 at 05:08:40AM +0200, Polytropon wrote:
> On Mon, 19 Oct 2009 08:58:05 -0500, David Kelly <dkelly@hiwaay.net> wrote:
> > On Mon, Oct 19, 2009 at 05:43:44AM +0200, Polytropon wrote:
> > > to make sure s is not NULL, or testing for it explicitely like
> > > 
> > > 	if(!s)
> > > 		... error handling here ...
> > 
> > You are missing my point that *s == 0 is not a good out of bounds
> > range check.
> 
> That's correct. Test != NULL just ensures that it is not a NULL
> pointer. Range checking should always be applied additionally.

Polytropon's "if(!s)" is testing for null pointer and thats a useful
test, but I'm testing for a pointer to a null which is something else.

Access through a null pointer should result in a memory violation core
dump.

-- 
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091020150718.GA42322>