This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: problem with malloc?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]