diff options
| author | itojun <itojun@NetBSD.org> | 2001-11-16 04:21:57 +0000 |
|---|---|---|
| committer | itojun <itojun@NetBSD.org> | 2001-11-16 04:21:57 +0000 |
| commit | 4a980893af024ce52a394b5f88c6d3855ba2a8d2 (patch) | |
| tree | 1a6217be10c9cd54def43724959e88a20d577188 /lib/libc/string | |
| parent | 26d3d8763551e1694b9d3c3cebd3a83a795bacfe (diff) | |
sync with latest openbsd one. this one describes corner case of strlcat better
Diffstat (limited to 'lib/libc/string')
| -rw-r--r-- | lib/libc/string/strlcpy.3 | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/libc/string/strlcpy.3 b/lib/libc/string/strlcpy.3 index aeba45b3c79..ecb7f514e84 100644 --- a/lib/libc/string/strlcpy.3 +++ b/lib/libc/string/strlcpy.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: strlcpy.3,v 1.7 2001/09/16 01:41:10 wiz Exp $ +.\" $NetBSD: strlcpy.3,v 1.8 2001/11/16 04:21:57 itojun Exp $ .\" from OpenBSD: strlcpy.3,v 1.11 2000/11/16 23:27:41 angelos Exp .\" .\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -121,6 +121,27 @@ 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 +and the destination string will not be NUL-terminated (since there was +no space for the NUL). +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 |
