summaryrefslogtreecommitdiff
path: root/lib/libc/string/strlcpy.3
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-05-07 15:51:55 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-05-07 15:51:55 +0000
commitb06b0b1e09ca0f16fae001a4f23ab6ad98c20547 (patch)
tree67f566f583455fe2f7eb90839861afcde79608c0 /lib/libc/string/strlcpy.3
parent0baf29dca4993e94a2e9abb3b18b3e2486cff527 (diff)
Document boundary condition when size < strlen(dst).
Diffstat (limited to 'lib/libc/string/strlcpy.3')
-rw-r--r--lib/libc/string/strlcpy.321
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/libc/string/strlcpy.3 b/lib/libc/string/strlcpy.3
index c1e8a0d510b..3d50e0b0f68 100644
--- a/lib/libc/string/strlcpy.3
+++ b/lib/libc/string/strlcpy.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: strlcpy.3,v 1.11 2000/11/16 23:27:41 angelos Exp $
+.\" $OpenBSD: strlcpy.3,v 1.12 2001/05/07 15:51:54 millert Exp $
.\"
.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
.\" All rights reserved.
@@ -118,6 +118,25 @@ the length of
.Fa src .
While this may seem somewhat confusing it was done to make
truncation detection simple.
+.Pp
+Note however, that if
+.Fn strlcat
+traverses
+.Fa size
+characters without finding a NUL, the length of the string is considered
+to be
+.Fa size .
+This keeps
+.Fn strlcat
+from running off the end of a string.
+In practice this should not happen (as it means that either
+.Fa size
+is incorrect or that
+.Fa dst
+is not a proper
+.Dq C
+string).
+The check exists to prevent potential security problems in incorrect code.
.Sh EXAMPLES
The following code fragment illustrates the simple case:
.Bd -literal -offset indent