From owner-freebsd-doc Sat Dec 29 6:20: 8 2001 Delivered-To: freebsd-doc@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CB89D37B41E for ; Sat, 29 Dec 2001 06:20:00 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fBTEK0l46697; Sat, 29 Dec 2001 06:20:00 -0800 (PST) (envelope-from gnats) Received: from raven.robbins.dropbear.id.au (185.c.001.mel.iprimus.net.au [203.134.131.185]) by hub.freebsd.org (Postfix) with ESMTP id F02EC37B41F for ; Sat, 29 Dec 2001 06:10:58 -0800 (PST) Received: (from tim@localhost) by raven.robbins.dropbear.id.au (8.11.6/8.11.6) id fBTE4sD03874; Sun, 30 Dec 2001 01:04:54 +1100 (EST) (envelope-from tim) Message-Id: <200112291404.fBTE4sD03874@raven.robbins.dropbear.id.au> Date: Sun, 30 Dec 2001 01:04:54 +1100 (EST) From: "Tim J. Robbins" Reply-To: "Tim J. Robbins" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: docs/33298: memcpy(3) could suggest memmove for overlapping copies Sender: owner-freebsd-doc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 33298 >Category: docs >Synopsis: memcpy(3) could suggest memmove for overlapping copies >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Dec 29 06:20:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: Tim J. Robbins >Release: FreeBSD 4.5-PRERELEASE i386 >Organization: >Environment: System: FreeBSD raven.robbins.dropbear.id.au 4.5-PRERELEASE FreeBSD 4.5-PRERELEASE #2: Thu Dec 27 22:09:06 EST 2001 tim@raven.robbins.dropbear.id.au:/usr/obj/usr/src/sys/RAVEN i386 >Description: 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(). >How-To-Repeat: man 3 memcpy >Fix: --- 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. .. or something to that effect. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message