Page MenuHomeFreeBSD

D27228.id129461.diff
No OneTemporary

D27228.id129461.diff

diff --git a/lib/libc/string/strlcpy.3 b/lib/libc/string/strlcpy.3
--- a/lib/libc/string/strlcpy.3
+++ b/lib/libc/string/strlcpy.3
@@ -25,7 +25,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd May 1, 2020
+.Dd October 27, 2023
.Dt STRLCPY 3
.Os
.Sh NAME
@@ -45,9 +45,11 @@
.Fn strlcpy
and
.Fn strlcat
-functions copy and concatenate strings with the
-same input parameters and output result as
-.Xr snprintf 3 .
+functions copy and concatenate strings with the same input parameters and output result as
+.Xr strcpy 3
+and
+.Xr strcat 3
+with proper overflow protection.
They are designed to be safer, more consistent, and less error
prone replacements for the easily misused functions
.Xr strncpy 3
@@ -100,22 +102,7 @@
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES
-Besides quibbles over the return type
-.Pf ( Va size_t
-versus
-.Va int )
-and signal handler safety
-.Pf ( Xr snprintf 3
-is not entirely safe on some systems), the
-following two are equivalent:
-.Bd -literal -offset indent
-n = strlcpy(dst, src, len);
-n = snprintf(dst, len, "%s", src);
-.Ed
-.Pp
-Like
-.Xr snprintf 3 ,
-the
+The
.Fn strlcpy
and
.Fn strlcat

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 28, 12:27 PM (16 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30472356
Default Alt Text
D27228.id129461.diff (1 KB)

Event Timeline