From owner-svn-src-stable-11@freebsd.org Tue Jan 22 21:52:09 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94BE514B0D90; Tue, 22 Jan 2019 21:52:09 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3706072539; Tue, 22 Jan 2019 21:52:09 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A14675F2; Tue, 22 Jan 2019 21:52:09 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0MLq9YL085233; Tue, 22 Jan 2019 21:52:09 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0MLq8ZD085230; Tue, 22 Jan 2019 21:52:08 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201901222152.x0MLq8ZD085230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Tue, 22 Jan 2019 21:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r343326 - in stable: 10/lib/libc/string 11/lib/libc/string X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: in stable: 10/lib/libc/string 11/lib/libc/string X-SVN-Commit-Revision: 343326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3706072539 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2019 21:52:09 -0000 Author: rgrimes Date: Tue Jan 22 21:52:07 2019 New Revision: 343326 URL: https://svnweb.freebsd.org/changeset/base/343326 Log: MFC: 325765 (imp) Add notes about overlapping copies. Add notes to each of these that specifically state that results are undefined if the strings overlap. In the case of memcpy, we document the overlapping behavior on FreeBSD (pre-existing). For str*, it is left unspecified, however, since the default (and x86) implementations do not handle overlapping strings properly. PR: 223653 Approved by: phk (mentor) Modified: stable/11/lib/libc/string/memcpy.3 stable/11/lib/libc/string/strcat.3 stable/11/lib/libc/string/strcpy.3 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libc/string/memcpy.3 stable/10/lib/libc/string/strcat.3 stable/10/lib/libc/string/strcpy.3 Directory Properties: stable/10/ (props changed) Modified: stable/11/lib/libc/string/memcpy.3 ============================================================================== --- stable/11/lib/libc/string/memcpy.3 Tue Jan 22 21:35:25 2019 (r343325) +++ stable/11/lib/libc/string/memcpy.3 Tue Jan 22 21:52:07 2019 (r343326) @@ -54,6 +54,11 @@ bytes from string .Fa src to string .Fa dst . +If +.Fa src +and +.Fa dst +overlap, the results are not defined. .Sh RETURN VALUES The .Fn memcpy Modified: stable/11/lib/libc/string/strcat.3 ============================================================================== --- stable/11/lib/libc/string/strcat.3 Tue Jan 22 21:35:25 2019 (r343325) +++ stable/11/lib/libc/string/strcat.3 Tue Jan 22 21:52:07 2019 (r343326) @@ -62,6 +62,11 @@ then add a terminating The string .Fa s must have sufficient space to hold the result. +If +.Fa s +and +.Fa append +overlap, the results are undefined. .Pp The .Fn strncat @@ -72,6 +77,11 @@ characters from .Fa append , and then adds a terminating .Ql \e0 . +If +.Fa s +and +.Fa append +overlap, the results are undefined. .Sh RETURN VALUES The .Fn strcat Modified: stable/11/lib/libc/string/strcpy.3 ============================================================================== --- stable/11/lib/libc/string/strcpy.3 Tue Jan 22 21:35:25 2019 (r343325) +++ stable/11/lib/libc/string/strcpy.3 Tue Jan 22 21:52:07 2019 (r343326) @@ -63,6 +63,11 @@ to (including the terminating .Ql \e0 character.) +If +.Fa src +and +.Fa dst +overlap, the results are undefined. .Pp The .Fn stpncpy @@ -89,6 +94,11 @@ Otherwise, is .Em not terminated. +If +.Fa src +and +.Fa dst +overlap, the results are undefined. .Sh RETURN VALUES The .Fn strcpy