Using strlcpy if target OS allows it

Marc Espie espie@nerim.net
Mon Apr 18 22:49:00 GMT 2005


On Mon, Apr 18, 2005 at 01:53:52PM -0700, Joe Buck wrote:

> Clearly a local patch to use strlcpy instead of strcpy in the testsuite
> doesn't hurt performance of the installed library, and other uses of
> strcpy in the include headers are all equivalent to strdup: allocate
> strlen()+1 elements and copy to it.  Is strdup a blessed routine on
> OpenBSD?  If so, you could use it (and avoid my objection to strlcpy:
> for every use of strcpy the buffer is exactly the right size, so using
> strlcpy to check for overflow is wasteful).

Nope. It's a C++ FAQ, you can't use strdup.



More information about the Libstdc++ mailing list