git: 37296464defd - main - memcpy.3: remove BUGS section allowing overlapping strings

Ed Maste emaste at FreeBSD.org
Tue Aug 24 13:59:22 UTC 2021


The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=37296464defda0aa769c39ab554deb4875aef000

commit 37296464defda0aa769c39ab554deb4875aef000
Author:     Ed Maste <emaste at FreeBSD.org>
AuthorDate: 2021-08-24 13:20:18 +0000
Commit:     Ed Maste <emaste at FreeBSD.org>
CommitDate: 2021-08-24 13:58:10 +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
---
 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 c65e4145264a..66a91592d90e 100644
--- a/lib/libc/string/memcpy.3
+++ b/lib/libc/string/memcpy.3
@@ -86,19 +86,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.


More information about the dev-commits-src-all mailing list