git: 0e6bf38b578b - stable/13 - memcpy.3: remove BUGS section allowing overlapping strings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 24 Sep 2023 15:49:54 UTC
The branch stable/13 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=0e6bf38b578b7b0a5bef0d8dbfb1fe6b1d9868f9
commit 0e6bf38b578b7b0a5bef0d8dbfb1fe6b1d9868f9
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2021-08-24 13:20:18 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-09-24 15:48:33 +0000
memcpy.3: remove BUGS section allowing overlapping strings
The removed text claimed that memcpy is implemented using bcopy and thus
strings may overlap. Use of bcopy is an implementation detail that is
no longer true, even if the implementation (on some archs) does allow
overlap.
In any case behaviour is undefined per the C standard if memcpy is
called with overlapping objects, and this man page already claimed that
src and dst may not overlap.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31192
(cherry picked from commit 37296464defda0aa769c39ab554deb4875aef000)
---
lib/libc/string/memcpy.3 | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/lib/libc/string/memcpy.3 b/lib/libc/string/memcpy.3
index c1aa2d4dd8f5..5ce43d5dfe75 100644
--- a/lib/libc/string/memcpy.3
+++ b/lib/libc/string/memcpy.3
@@ -85,19 +85,3 @@ The
function
conforms to
.St -isoC .
-.Sh BUGS
-In this implementation
-.Fn memcpy
-and
-.Fn mempcpy
-are implemented using
-.Xr bcopy 3 ,
-and therefore the strings may overlap.
-On other systems, copying overlapping strings may produce surprises.
-Programs intended to be portable should use
-.Xr memmove 3
-when
-.Fa src
-and
-.Fa dst
-may overlap.