Subject: Re: 'Safe' string copy: strlcpy() or strncpy() ?
To: =?iso-8859-1?Q?Jarom=EDr_Dolecek?= <dolecek@ics.muni.cz>
From: Matthias Buelow <mkb@mukappabeta.de>
List: tech-userlevel
Date: 01/26/2001 21:45:54
Jaromír Dolecek <dolecek@ics.muni.cz> writes:

>Separate, though related question: should old code be converted to
>use strlcpy() instead of strncpy()  ?

strncpy() is portable and standardized (ANSI/ISO C), while strlcpy()
is not (it only seems to exist in newer OpenBSD, FreeBSD and NetBSD
versions, newer being post-OpenBSD 2.4, where it made its appearance,
obviously).  So you chose -- more safety for inexperienced programmers
versus portability.  I usually go for the latter.

mkb