summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormillert <>2001-05-07 15:51:54 +0000
committermillert <>2001-05-07 15:51:54 +0000
commit659f0cfd901dd94e8179c59b2d0bfc91dbc84451 (patch)
tree05b6cac51326826c1df70cff6afa5041dcc29c8e
parent541e7032b035300e49959a9edfb6a65f778e1b12 (diff)
downloadopenbsd-659f0cfd901dd94e8179c59b2d0bfc91dbc84451.tar.gz
openbsd-659f0cfd901dd94e8179c59b2d0bfc91dbc84451.tar.bz2
openbsd-659f0cfd901dd94e8179c59b2d0bfc91dbc84451.zip
Document boundary condition when size < strlen(dst).
-rw-r--r--src/lib/libc/string/strlcpy.321
1 files changed, 20 insertions, 1 deletions
diff --git a/src/lib/libc/string/strlcpy.3 b/src/lib/libc/string/strlcpy.3
index c1e8a0d510..3d50e0b0f6 100644
--- a/src/lib/libc/string/strlcpy.3
+++ b/src/lib/libc/string/strlcpy.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: strlcpy.3,v 1.11 2000/11/16 23:27:41 angelos Exp $ 1.\" $OpenBSD: strlcpy.3,v 1.12 2001/05/07 15:51:54 millert Exp $
2.\" 2.\"
3.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> 3.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
4.\" All rights reserved. 4.\" All rights reserved.
@@ -118,6 +118,25 @@ the length of
118.Fa src . 118.Fa src .
119While this may seem somewhat confusing it was done to make 119While this may seem somewhat confusing it was done to make
120truncation detection simple. 120truncation detection simple.
121.Pp
122Note however, that if
123.Fn strlcat
124traverses
125.Fa size
126characters without finding a NUL, the length of the string is considered
127to be
128.Fa size .
129This keeps
130.Fn strlcat
131from running off the end of a string.
132In practice this should not happen (as it means that either
133.Fa size
134is incorrect or that
135.Fa dst
136is not a proper
137.Dq C
138string).
139The check exists to prevent potential security problems in incorrect code.
121.Sh EXAMPLES 140.Sh EXAMPLES
122The following code fragment illustrates the simple case: 141The following code fragment illustrates the simple case:
123.Bd -literal -offset indent 142.Bd -literal -offset indent