diff options
-rw-r--r-- | src/lib/libc/string/strlcpy.3 | 21 |
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 . |
119 | While this may seem somewhat confusing it was done to make | 119 | While this may seem somewhat confusing it was done to make |
120 | truncation detection simple. | 120 | truncation detection simple. |
121 | .Pp | ||
122 | Note however, that if | ||
123 | .Fn strlcat | ||
124 | traverses | ||
125 | .Fa size | ||
126 | characters without finding a NUL, the length of the string is considered | ||
127 | to be | ||
128 | .Fa size . | ||
129 | This keeps | ||
130 | .Fn strlcat | ||
131 | from running off the end of a string. | ||
132 | In practice this should not happen (as it means that either | ||
133 | .Fa size | ||
134 | is incorrect or that | ||
135 | .Fa dst | ||
136 | is not a proper | ||
137 | .Dq C | ||
138 | string). | ||
139 | The check exists to prevent potential security problems in incorrect code. | ||
121 | .Sh EXAMPLES | 140 | .Sh EXAMPLES |
122 | The following code fragment illustrates the simple case: | 141 | The following code fragment illustrates the simple case: |
123 | .Bd -literal -offset indent | 142 | .Bd -literal -offset indent |