This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: problem with malloc?
- To: kaz at ashi dot footprints dot net (Kaz Kylheku)
- Subject: Re: problem with malloc?
- From: "tjk at tksoft dot com" <tjk at tksoft dot com>
- Date: Sat, 22 Apr 2000 23:31:05 -0700 (PDT)
- Cc: tjk at tksoft dot com, glibc-linux at ricardo dot ecn dot wfu dot edu
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
hehe
You are absolutely correct.
Thanks for making me laugh at myself.
Troy
>
> On Sat, 22 Apr 2000, tjk@tksoft.com wrote:
>
> > > >You can't blindly substitute one for the other. The strncpy function does
> > > >not ensure null termination of the target array in all cases.
> > >
> > > Yeah I know. I read the man page. I wasn't too worried about the NULL
> > > termination right at the moment. I wanted to find the source of the seg.
> > > fault. I think I could just do something like
> > >
> > > strcat( target ,'\0' );
> > >
> > > assuming the target buffer is big enough that is.
> >
> >
> > You meant to say:
> > strcat( target ,"\0" );
>
> Corrected or not, this is utterly pointless. The strcat() function requires the
> first parameter to point to a null terminated array of characters.
>
>