diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2013-09-25 21:49:32 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2013-09-25 21:49:32 +0000 |
commit | 6ba1facf997aa1bcbf74124c61290ab3be7e0927 (patch) | |
tree | 6e6a858dcf88250033a09c8f4a786ad1848bbd2b /lib/libc | |
parent | d133037a4116d11b85ea4f43bbc13ab270e86fe0 (diff) |
According to POSIX, if the src and dst strings overlap, the behavior
is undefined. Add a warning to that effect. OK deraadt@ jmc@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/string/memccpy.3 | 10 | ||||
-rw-r--r-- | lib/libc/string/stpcpy.3 | 10 | ||||
-rw-r--r-- | lib/libc/string/strcpy.3 | 10 | ||||
-rw-r--r-- | lib/libc/string/strlcpy.3 | 10 | ||||
-rw-r--r-- | lib/libc/string/wcscpy.3 | 10 | ||||
-rw-r--r-- | lib/libc/string/wcslcpy.3 | 10 |
6 files changed, 48 insertions, 12 deletions
diff --git a/lib/libc/string/memccpy.3 b/lib/libc/string/memccpy.3 index 076e8f64abe..98326d68713 100644 --- a/lib/libc/string/memccpy.3 +++ b/lib/libc/string/memccpy.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: memccpy.3,v 1.11 2013/06/05 03:39:23 tedu Exp $ +.\" $OpenBSD: memccpy.3,v 1.12 2013/09/25 21:49:30 millert Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93 .\" -.Dd $Mdocdate: June 5 2013 $ +.Dd $Mdocdate: September 25 2013 $ .Dt MEMCCPY 3 .Os .Sh NAME @@ -60,6 +60,12 @@ is returned. Otherwise, .Fa len bytes are copied, and a null pointer is returned. +.Pp +If the +.Fa src +and +.Fa dst +strings overlap, the behavior is undefined. .Sh SEE ALSO .Xr bcopy 3 , .Xr memcpy 3 , diff --git a/lib/libc/string/stpcpy.3 b/lib/libc/string/stpcpy.3 index ed1b830b56e..ea25610717d 100644 --- a/lib/libc/string/stpcpy.3 +++ b/lib/libc/string/stpcpy.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: stpcpy.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ +.\" $OpenBSD: stpcpy.3,v 1.4 2013/09/25 21:49:31 millert Exp $ .\" .\" Copyright (c) 1990, 1991 The Regents of the University of California. .\" All rights reserved. @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: June 5 2013 $ +.Dd $Mdocdate: September 25 2013 $ .Dt STPCPY 3 .Os .Sh NAME @@ -77,6 +77,12 @@ if the length of .Fa src is greater than or equal to .Fa len . +.Pp +If the +.Fa src +and +.Fa dst +strings overlap, the behavior is undefined. .Sh RETURN VALUES The .Fn stpcpy diff --git a/lib/libc/string/strcpy.3 b/lib/libc/string/strcpy.3 index 409f4c61d4f..798c7e8d997 100644 --- a/lib/libc/string/strcpy.3 +++ b/lib/libc/string/strcpy.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: strcpy.3,v 1.18 2013/07/17 05:42:11 schwarze Exp $ +.\" $OpenBSD: strcpy.3,v 1.19 2013/09/25 21:49:31 millert Exp $ .\" .\" Copyright (c) 1990, 1991 The Regents of the University of California. .\" All rights reserved. @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: July 17 2013 $ +.Dd $Mdocdate: September 25 2013 $ .Dt STRCPY 3 .Os .Sh NAME @@ -77,6 +77,12 @@ if the length of .Fa src is greater than or equal to .Fa len . +.Pp +If the +.Fa src +and +.Fa dst +strings overlap, the behavior is undefined. .Sh RETURN VALUES The .Fn strcpy diff --git a/lib/libc/string/strlcpy.3 b/lib/libc/string/strlcpy.3 index a0028a52b16..a7cd269819e 100644 --- a/lib/libc/string/strlcpy.3 +++ b/lib/libc/string/strlcpy.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: strlcpy.3,v 1.24 2013/07/16 15:21:11 schwarze Exp $ +.\" $OpenBSD: strlcpy.3,v 1.25 2013/09/25 21:49:31 millert Exp $ .\" .\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 16 2013 $ +.Dd $Mdocdate: September 25 2013 $ .Dt STRLCPY 3 .Os .Sh NAME @@ -80,6 +80,12 @@ as it means that either is incorrect or that .Fa dst is not a proper string). +.Pp +If the +.Fa src +and +.Fa dst +strings overlap, the behavior is undefined. .Sh RETURN VALUES Besides quibbles over the return type .Pf ( Va size_t diff --git a/lib/libc/string/wcscpy.3 b/lib/libc/string/wcscpy.3 index c366103565d..2277eb419a4 100644 --- a/lib/libc/string/wcscpy.3 +++ b/lib/libc/string/wcscpy.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: wcscpy.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ +.\" $OpenBSD: wcscpy.3,v 1.4 2013/09/25 21:49:31 millert Exp $ .\" .\" Copyright (c) 1990, 1991 The Regents of the University of California. .\" All rights reserved. @@ -31,7 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: June 5 2013 $ +.Dd $Mdocdate: September 25 2013 $ .Dt WCSCPY 3 .Os .Sh NAME @@ -77,6 +77,12 @@ if the length of .Fa src is greater than or equal to .Fa len . +.Pp +If the +.Fa src +and +.Fa dst +strings overlap, the behavior is undefined. .Sh RETURN VALUES The .Fn wcscpy diff --git a/lib/libc/string/wcslcpy.3 b/lib/libc/string/wcslcpy.3 index a976654ccc0..7af6c746148 100644 --- a/lib/libc/string/wcslcpy.3 +++ b/lib/libc/string/wcslcpy.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: wcslcpy.3,v 1.5 2013/07/16 15:21:11 schwarze Exp $ +.\" $OpenBSD: wcslcpy.3,v 1.6 2013/09/25 21:49:31 millert Exp $ .\" .\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 16 2013 $ +.Dd $Mdocdate: September 25 2013 $ .Dt WCSLCPY 3 .Os .Sh NAME @@ -88,6 +88,12 @@ It will append at most .Fa size \(mi wcslen(dst) \(mi 1 wide characters, terminating the result with a null wide character. +.Pp +If the +.Fa src +and +.Fa dst +strings overlap, the behavior is undefined. .Sh RETURN VALUES The .Fn wcslcpy |