Browse Source

According to POSIX, if the src and dst strings overlap, the behavior

is undefined.  Add a warning to that effect.  OK deraadt@ jmc@
OPENBSD_5_5
millert 10 years ago
parent
commit
0f37c5c11d
6 changed files with 48 additions and 12 deletions
  1. +8
    -2
      src/lib/libc/string/memccpy.3
  2. +8
    -2
      src/lib/libc/string/stpcpy.3
  3. +8
    -2
      src/lib/libc/string/strcpy.3
  4. +8
    -2
      src/lib/libc/string/strlcpy.3
  5. +8
    -2
      src/lib/libc/string/wcscpy.3
  6. +8
    -2
      src/lib/libc/string/wcslcpy.3

+ 8
- 2
src/lib/libc/string/memccpy.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: memccpy.3,v 1.11 2013/06/05 03:39:23 tedu Exp $
.\" $OpenBSD: memccpy.3,v 1.12 2013/09/25 21:49:30 millert Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93
.\"
.Dd $Mdocdate: June 5 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt MEMCCPY 3
.Os
.Sh NAME
@ -60,6 +60,12 @@ is returned.
Otherwise,
.Fa len
bytes are copied, and a null pointer is returned.
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh SEE ALSO
.Xr bcopy 3 ,
.Xr memcpy 3 ,


+ 8
- 2
src/lib/libc/string/stpcpy.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: stpcpy.3,v 1.3 2013/06/05 03:39:23 tedu Exp $
.\" $OpenBSD: stpcpy.3,v 1.4 2013/09/25 21:49:31 millert Exp $
.\"
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 5 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt STPCPY 3
.Os
.Sh NAME
@ -77,6 +77,12 @@ if the length of
.Fa src
is greater than or equal to
.Fa len .
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES
The
.Fn stpcpy


+ 8
- 2
src/lib/libc/string/strcpy.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: strcpy.3,v 1.18 2013/07/17 05:42:11 schwarze Exp $
.\" $OpenBSD: strcpy.3,v 1.19 2013/09/25 21:49:31 millert Exp $
.\"
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: July 17 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt STRCPY 3
.Os
.Sh NAME
@ -77,6 +77,12 @@ if the length of
.Fa src
is greater than or equal to
.Fa len .
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES
The
.Fn strcpy


+ 8
- 2
src/lib/libc/string/strlcpy.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: strlcpy.3,v 1.24 2013/07/16 15:21:11 schwarze Exp $
.\" $OpenBSD: strlcpy.3,v 1.25 2013/09/25 21:49:31 millert Exp $
.\"
.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 16 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt STRLCPY 3
.Os
.Sh NAME
@ -80,6 +80,12 @@ as it means that either
is incorrect or that
.Fa dst
is not a proper string).
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES
Besides quibbles over the return type
.Pf ( Va size_t


+ 8
- 2
src/lib/libc/string/wcscpy.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: wcscpy.3,v 1.3 2013/06/05 03:39:23 tedu Exp $
.\" $OpenBSD: wcscpy.3,v 1.4 2013/09/25 21:49:31 millert Exp $
.\"
.\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved.
@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd $Mdocdate: June 5 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt WCSCPY 3
.Os
.Sh NAME
@ -77,6 +77,12 @@ if the length of
.Fa src
is greater than or equal to
.Fa len .
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES
The
.Fn wcscpy


+ 8
- 2
src/lib/libc/string/wcslcpy.3 View File

@ -1,4 +1,4 @@
.\" $OpenBSD: wcslcpy.3,v 1.5 2013/07/16 15:21:11 schwarze Exp $
.\" $OpenBSD: wcslcpy.3,v 1.6 2013/09/25 21:49:31 millert Exp $
.\"
.\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 16 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt WCSLCPY 3
.Os
.Sh NAME
@ -88,6 +88,12 @@ It will append at most
.Fa size
\(mi wcslen(dst) \(mi 1 wide characters, terminating the result with a null
wide character.
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES
The
.Fn wcslcpy


Loading…
Cancel
Save