summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/strcpy.3
diff options
context:
space:
mode:
authorderaadt <>2014-04-19 11:30:40 +0000
committerderaadt <>2014-04-19 11:30:40 +0000
commit597610ccf04bbca4e88fac7988877d0a06e02211 (patch)
treefcfc398023e666979cbe5ad67cb1e398e980f095 /src/lib/libc/string/strcpy.3
parent442335bf77f2f6653794378cc53adb59bba1ed12 (diff)
downloadopenbsd-597610ccf04bbca4e88fac7988877d0a06e02211.tar.gz
openbsd-597610ccf04bbca4e88fac7988877d0a06e02211.tar.bz2
openbsd-597610ccf04bbca4e88fac7988877d0a06e02211.zip
Use somewhat harsher language and better examples; demonstrate that
non-dangerous use functions is difficult. ok guenther
Diffstat (limited to 'src/lib/libc/string/strcpy.3')
-rw-r--r--src/lib/libc/string/strcpy.334
1 files changed, 13 insertions, 21 deletions
diff --git a/src/lib/libc/string/strcpy.3 b/src/lib/libc/string/strcpy.3
index 849184d1f5..7174f7c963 100644
--- a/src/lib/libc/string/strcpy.3
+++ b/src/lib/libc/string/strcpy.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: strcpy.3,v 1.20 2013/12/19 20:52:37 millert Exp $ 1.\" $OpenBSD: strcpy.3,v 1.21 2014/04/19 11:30:40 deraadt Exp $
2.\" 2.\"
3.\" Copyright (c) 1990, 1991 The Regents of the University of California. 3.\" Copyright (c) 1990, 1991 The Regents of the University of California.
4.\" All rights reserved. 4.\" All rights reserved.
@@ -31,12 +31,12 @@
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE. 32.\" SUCH DAMAGE.
33.\" 33.\"
34.Dd $Mdocdate: December 19 2013 $ 34.Dd $Mdocdate: April 19 2014 $
35.Dt STRCPY 3 35.Dt STRCPY 3
36.Os 36.Os
37.Sh NAME 37.Sh NAME
38.Nm strcpy 38.Nm strcpy
39.Nd copy a string 39.Nd copy a string without bounds checking
40.Sh SYNOPSIS 40.Sh SYNOPSIS
41.In string.h 41.In string.h
42.Ft char * 42.Ft char *
@@ -46,43 +46,35 @@ The
46.Fn strcpy 46.Fn strcpy
47function copies the string 47function copies the string
48.Fa src 48.Fa src
49to
50.Fa dst
51(including the terminating 49(including the terminating
52.Ql \e0 50.Ql \e0
53character). 51character) to the buffer
54The string 52.Fa dst .
53.Pp
54No bounds checking is performed.
55If the buffer
55.Fa dst 56.Fa dst
56must be at least as large as 57is not large enough to hold the result,
57.Fa src 58subsequent memory will be damaged.
58to hold the result.
59.Pp 59.Pp
60If the 60If the
61.Fa src 61.Fa src
62and 62string is inside the
63.Fa dst 63.Fa dst
64strings overlap, the behavior is undefined. 64buffer, the behavior is undefined.
65.Sh RETURN VALUES 65.Sh RETURN VALUES
66The 66The
67.Fn strcpy 67.Fn strcpy
68function returns 68function returns
69.Fa dst . 69.Fa dst .
70.Sh SEE ALSO 70.Sh SEE ALSO
71.Xr bcopy 3 ,
72.Xr memccpy 3 ,
73.Xr memcpy 3 ,
74.Xr memmove 3 ,
75.Xr strcat 3 ,
76.Xr strlcpy 3 , 71.Xr strlcpy 3 ,
77.Xr strncpy 3 ,
78.Xr wcscpy 3 , 72.Xr wcscpy 3 ,
79.Xr wcslcpy 3 73.Xr wcslcpy 3
80.Sh STANDARDS 74.Sh STANDARDS
81The 75The
82.Fn strcpy 76.Fn strcpy
83and 77function conforms to
84.Fn strncpy
85functions conform to
86.St -ansiC . 78.St -ansiC .
87.Sh HISTORY 79.Sh HISTORY
88The 80The