need C help, passing char buffer[] by-value....
David Kelly
dkelly at hiwaay.net
Tue Oct 20 15:07:21 UTC 2009
On Tue, Oct 20, 2009 at 05:08:40AM +0200, Polytropon wrote:
> On Mon, 19 Oct 2009 08:58:05 -0500, David Kelly <dkelly at 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 at HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.
More information about the freebsd-questions
mailing list