[Xastir-dev] Re: [Xastir] strcat/strcpy/strncpy functions

Curt, WE7U archer at eskimo.com
Fri Aug 20 14:27:50 EDT 2004


On Fri, 20 Aug 2004, Henk de Groot wrote:

> At 10:15 20-8-2004 -0700, Curt, WE7U wrote:
> >I've been busy this week getting rid of the above functions.  Here's
> >the old count:
> >
> >     strcat()  243
> >     strcpy()  511
> >     strncpy() 272
>
> Why do you want them to be replaced? I know these functions should be
> handled with case not to overrun allocated memory and such, but they are
> much, much faster in execution than the snprintf function. I hope the
> replacement will not give performance problems...

The ones without the 'n' can overrun string buffers, causing
segfaults or stack crashing, other problems.

Some of them can also fail to terminate the string under certain
conditions.

I'd trade speed for robustness any day.

--
Curt, WE7U			         http://www.eskimo.com/~archer
"Lotto:    A tax on people who are bad at math." -- unknown
"Windows:  Microsoft's tax on computer illiterates." -- WE7U
"The world DOES revolve around me:  I picked the coordinate system!"



More information about the Xastir-dev mailing list