This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: problem with malloc?
- To: "tjk at tksoft dot com" <tjk at tksoft dot com>
- Subject: Re: problem with malloc?
- From: Kaz Kylheku <kaz at ashi dot footprints dot net>
- Date: Sat, 22 Apr 2000 22:11:01 -0700 (PDT)
- cc: glibc-linux at ricardo dot ecn dot wfu dot edu
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
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.