From 597610ccf04bbca4e88fac7988877d0a06e02211 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Sat, 19 Apr 2014 11:30:40 +0000 Subject: Use somewhat harsher language and better examples; demonstrate that non-dangerous use functions is difficult. ok guenther --- src/lib/libc/string/strcpy.3 | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'src/lib/libc/string/strcpy.3') 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 @@ -.\" $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 -- cgit v1.2.3-55-g6feb