Bug 33298

Summary: memcpy(3) could suggest memmove for overlapping copies
Product: Documentation Reporter: Tim J. Robbins <tim>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Tim J. Robbins 2001-12-29 14:20:00 UTC
From memcpy(3):
BUGS
     In this implementation memcpy() is implemented using bcopy(3), and there-
     fore the strings may overlap.  On other systems, copying overlapping
     strings may produce surprises.  A simpler solution is to not use
     memcpy().

Using memmove() is simpler than not using memcpy().

Fix: 

.. or something to that effect.--XyW2VBaR9wNH3h8wJETuFrpohvj1XufeDSGXpgzp6NfFEnzK
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- memcpy.3.old	Sun Dec 30 00:55:49 2001
+++ memcpy.3	Sun Dec 30 00:59:20 2001
@@ -82,5 +82,10 @@
 .Xr bcopy 3 ,
 and therefore the strings may overlap.
 On other systems, copying overlapping strings may produce surprises.
-A simpler solution is to not use
-.Fn memcpy .
+Programs intended to be portable should use
+.Fn memmove
+when
+.Fa src
+and
+.Fa dst
+may overlap.
How-To-Repeat: man 3 memcpy
Comment 1 dd freebsd_committer freebsd_triage 2002-01-07 06:03:42 UTC
State Changed
From-To: open->closed

applied, thanks.