summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormillert <>2002-05-13 17:04:43 +0000
committermillert <>2002-05-13 17:04:43 +0000
commitc1491265c93a6e980cb9120a5364d2f892a03b98 (patch)
treefa99582b5c031acb5d023d211b3e851be11e90c5
parentc5c2a45fa0e5d6fbc606411f9c7617152b3a1d48 (diff)
downloadopenbsd-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.311
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
77terminating 77terminating
78.Fa dst 78.Fa dst
79if 79if the length of
80.Fa src 80.Fa src
81is more than 81is greater than or equal to
82.Fa len 82.Fa len .
83characters long.
84.Sh RETURN VALUES 83.Sh RETURN VALUES
85The 84The
86.Fn strcpy 85.Fn strcpy
@@ -108,7 +107,7 @@ null terminate
108because the source string is >= the length parameter. 107because the source string is >= the length parameter.
109.Fn strncpy 108.Fn strncpy
110.Em only 109.Em only
111null terminates the destination string when then length of the source 110null terminates the destination string when the length of the source
112string is less than the length parameter. 111string 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);