diff options
author | millert <> | 2002-05-13 17:04:43 +0000 |
---|---|---|
committer | millert <> | 2002-05-13 17:04:43 +0000 |
commit | c1491265c93a6e980cb9120a5364d2f892a03b98 (patch) | |
tree | fa99582b5c031acb5d023d211b3e851be11e90c5 | |
parent | c5c2a45fa0e5d6fbc606411f9c7617152b3a1d48 (diff) | |
download | openbsd-c1491265c93a6e980cb9120a5364d2f892a03b98.tar.gz openbsd-c1491265c93a6e980cb9120a5364d2f892a03b98.tar.bz2 openbsd-c1491265c93a6e980cb9120a5364d2f892a03b98.zip |
For strncpy(), dst is not NUL terminated if strlen(src) >= len.
Also fix a typo; adapted from a patch by Moritz Jodeit
-rw-r--r-- | src/lib/libc/string/strcpy.3 | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/libc/string/strcpy.3 b/src/lib/libc/string/strcpy.3 index 1dbeafa6e8..d3c095916b 100644 --- a/src/lib/libc/string/strcpy.3 +++ b/src/lib/libc/string/strcpy.3 | |||
@@ -33,7 +33,7 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: strcpy.3,v 1.10 2000/04/21 15:24:20 aaron Exp $ | 36 | .\" $OpenBSD: strcpy.3,v 1.11 2002/05/13 17:04:43 millert Exp $ |
37 | .\" | 37 | .\" |
38 | .Dd June 29, 1991 | 38 | .Dd June 29, 1991 |
39 | .Dt STRCPY 3 | 39 | .Dt STRCPY 3 |
@@ -76,11 +76,10 @@ characters long, and | |||
76 | .Em not | 76 | .Em not |
77 | terminating | 77 | terminating |
78 | .Fa dst | 78 | .Fa dst |
79 | if | 79 | if the length of |
80 | .Fa src | 80 | .Fa src |
81 | is more than | 81 | is greater than or equal to |
82 | .Fa len | 82 | .Fa len . |
83 | characters long. | ||
84 | .Sh RETURN VALUES | 83 | .Sh RETURN VALUES |
85 | The | 84 | The |
86 | .Fn strcpy | 85 | .Fn strcpy |
@@ -108,7 +107,7 @@ null terminate | |||
108 | because the source string is >= the length parameter. | 107 | because the source string is >= the length parameter. |
109 | .Fn strncpy | 108 | .Fn strncpy |
110 | .Em only | 109 | .Em only |
111 | null terminates the destination string when then length of the source | 110 | null terminates the destination string when the length of the source |
112 | string is less than the length parameter. | 111 | string is less than the length parameter. |
113 | .Bd -literal -offset indent | 112 | .Bd -literal -offset indent |
114 | (void)strncpy(chararray, "abcdefgh", 6); | 113 | (void)strncpy(chararray, "abcdefgh", 6); |