summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strcpy.3
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-04-19 11:30:40 +0000
committerderaadt <deraadt@openbsd.org>2014-04-19 11:30:40 +0000
commit5d354709047d762de49ee774c57d23b877c33736 (patch)
tree796da3f35cbcf11acc1f91d1e1c3e7942e074830 /lib/libc/string/strcpy.3
parentwhen copying socket path, check that we didnt truncate it which would cause (diff)
downloadwireguard-openbsd-5d354709047d762de49ee774c57d23b877c33736.tar.xz
wireguard-openbsd-5d354709047d762de49ee774c57d23b877c33736.zip
Use somewhat harsher language and better examples; demonstrate that
non-dangerous use functions is difficult. ok guenther
Diffstat (limited to 'lib/libc/string/strcpy.3')
-rw-r--r--lib/libc/string/strcpy.334
1 files changed, 13 insertions, 21 deletions
diff --git a/lib/libc/string/strcpy.3 b/lib/libc/string/strcpy.3
index 849184d1f54..7174f7c963c 100644
--- a/lib/libc/string/strcpy.3
+++ b/lib/libc/string/strcpy.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: strcpy.3,v 1.20 2013/12/19 20:52:37 millert Exp $
+.\" $OpenBSD: strcpy.3,v 1.21 2014/04/19 11:30:40 deraadt Exp $
.\"
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
@@ -31,12 +31,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: December 19 2013 $
+.Dd $Mdocdate: April 19 2014 $
.Dt STRCPY 3
.Os
.Sh NAME
.Nm strcpy
-.Nd copy a string
+.Nd copy a string without bounds checking
.Sh SYNOPSIS
.In string.h
.Ft char *
@@ -46,43 +46,35 @@ The
.Fn strcpy
function copies the string
.Fa src
-to
-.Fa dst
(including the terminating
.Ql \e0
-character).
-The string
+character) to the buffer
+.Fa dst .
+.Pp
+No bounds checking is performed.
+If the buffer
.Fa dst
-must be at least as large as
-.Fa src
-to hold the result.
+is not large enough to hold the result,
+subsequent memory will be damaged.
.Pp
If the
.Fa src
-and
+string is inside the
.Fa dst
-strings overlap, the behavior is undefined.
+buffer, the behavior is undefined.
.Sh RETURN VALUES
The
.Fn strcpy
function returns
.Fa dst .
.Sh SEE ALSO
-.Xr bcopy 3 ,
-.Xr memccpy 3 ,
-.Xr memcpy 3 ,
-.Xr memmove 3 ,
-.Xr strcat 3 ,
.Xr strlcpy 3 ,
-.Xr strncpy 3 ,
.Xr wcscpy 3 ,
.Xr wcslcpy 3
.Sh STANDARDS
The
.Fn strcpy
-and
-.Fn strncpy
-functions conform to
+function conforms to
.St -ansiC .
.Sh HISTORY
The