diff options
| author | millert <> | 2000-06-01 04:02:05 +0000 |
|---|---|---|
| committer | millert <> | 2000-06-01 04:02:05 +0000 |
| commit | cd7d1ba7e87aff9e7477e82c87f5e901e7daba35 (patch) | |
| tree | 3cfd0b837f374aa396c144f09f9e78f934e43cd1 /src/lib/libc | |
| parent | 92eb2fcdc3e8b09e3e9f6d84155436039d1cc1d6 (diff) | |
| download | openbsd-cd7d1ba7e87aff9e7477e82c87f5e901e7daba35.tar.gz openbsd-cd7d1ba7e87aff9e7477e82c87f5e901e7daba35.tar.bz2 openbsd-cd7d1ba7e87aff9e7477e82c87f5e901e7daba35.zip | |
State explicitly that strlc{py,at} only work on real C strings.
Clarify point about always NUL-terminating.
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/string/strlcpy.3 | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/lib/libc/string/strlcpy.3 b/src/lib/libc/string/strlcpy.3 index 03a80e6c79..5acbcce148 100644 --- a/src/lib/libc/string/strlcpy.3 +++ b/src/lib/libc/string/strlcpy.3 | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | .\" $OpenBSD: strlcpy.3,v 1.7 2000/04/21 15:24:20 aaron Exp $ | 1 | .\" $OpenBSD: strlcpy.3,v 1.8 2000/06/01 04:02:05 millert Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 1998 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. |
| 5 | .\" | 5 | .\" |
| 6 | .\" Redistribution and use in source and binary forms, with or without | 6 | .\" Redistribution and use in source and binary forms, with or without |
| @@ -56,9 +56,28 @@ and | |||
| 56 | take the full size of the buffer (not just the length) and guarantee to | 56 | take the full size of the buffer (not just the length) and guarantee to |
| 57 | NUL-terminate the result (as long as | 57 | NUL-terminate the result (as long as |
| 58 | .Fa size | 58 | .Fa size |
| 59 | is larger than 0). | 59 | is larger than 0 or, in the case of |
| 60 | .Fn strlcat , | ||
| 61 | as long as there is at least one byte free in | ||
| 62 | .Fa dst ) . | ||
| 60 | Note that you should include a byte for the NUL in | 63 | Note that you should include a byte for the NUL in |
| 61 | .Fa size . | 64 | .Fa size . |
| 65 | Also note that | ||
| 66 | .Fn strlcpy | ||
| 67 | and | ||
| 68 | .Fn strlcat | ||
| 69 | only operate on true | ||
| 70 | .Dq C | ||
| 71 | strings. This means that for | ||
| 72 | .Fn strlcpy | ||
| 73 | .Fa src | ||
| 74 | must be NUL-terminated and for | ||
| 75 | .Fn strlcat | ||
| 76 | both | ||
| 77 | .Fa src | ||
| 78 | and | ||
| 79 | .Fa dst | ||
| 80 | must be NUL-terminated. | ||
| 62 | .Pp | 81 | .Pp |
| 63 | The | 82 | The |
| 64 | .Fn strlcpy | 83 | .Fn strlcpy |
