Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jan 2019 21:52:07 +0000 (UTC)
From:      "Rodney W. Grimes" <rgrimes@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r343326 - in stable: 10/lib/libc/string 11/lib/libc/string
Message-ID:  <201901222152.x0MLq7LK085222@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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/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)

Changes in other areas also in this revision:
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)

Modified: stable/10/lib/libc/string/memcpy.3
==============================================================================
--- stable/10/lib/libc/string/memcpy.3	Tue Jan 22 21:35:25 2019	(r343325)
+++ stable/10/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/10/lib/libc/string/strcat.3
==============================================================================
--- stable/10/lib/libc/string/strcat.3	Tue Jan 22 21:35:25 2019	(r343325)
+++ stable/10/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/10/lib/libc/string/strcpy.3
==============================================================================
--- stable/10/lib/libc/string/strcpy.3	Tue Jan 22 21:35:25 2019	(r343325)
+++ stable/10/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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901222152.x0MLq7LK085222>