diff options
| author | millert <> | 2001-05-07 15:51:54 +0000 |
|---|---|---|
| committer | millert <> | 2001-05-07 15:51:54 +0000 |
| commit | 659f0cfd901dd94e8179c59b2d0bfc91dbc84451 (patch) | |
| tree | 05b6cac51326826c1df70cff6afa5041dcc29c8e /src | |
| parent | 541e7032b035300e49959a9edfb6a65f778e1b12 (diff) | |
| download | openbsd-659f0cfd901dd94e8179c59b2d0bfc91dbc84451.tar.gz openbsd-659f0cfd901dd94e8179c59b2d0bfc91dbc84451.tar.bz2 openbsd-659f0cfd901dd94e8179c59b2d0bfc91dbc84451.zip | |
Document boundary condition when size < strlen(dst).
Diffstat (limited to 'src')
| -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 |
