Subject: Re: 'Safe' string copy: strlcpy() or strncpy() ?
To: =?iso-8859-1?Q?Jarom=EDr_Dolecek?= <>
From: Matthias Buelow <>
List: tech-userlevel
Date: 01/26/2001 21:45:54
Jaromír Dolecek <> 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.