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 .\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\" .\"
.\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93 .\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93
.\" .\"
.Dd $Mdocdate: June 5 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt MEMCCPY 3 .Dt MEMCCPY 3
.Os .Os
.Sh NAME .Sh NAME
@ -60,6 +60,12 @@ is returned.
Otherwise, Otherwise,
.Fa len .Fa len
bytes are copied, and a null pointer is returned. 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 .Sh SEE ALSO
.Xr bcopy 3 , .Xr bcopy 3 ,
.Xr memcpy 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. .\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved. .\" All rights reserved.
@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: June 5 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt STPCPY 3 .Dt STPCPY 3
.Os .Os
.Sh NAME .Sh NAME
@ -77,6 +77,12 @@ if the length of
.Fa src .Fa src
is greater than or equal to is greater than or equal to
.Fa len . .Fa len .
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES .Sh RETURN VALUES
The The
.Fn stpcpy .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. .\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved. .\" All rights reserved.
@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: July 17 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt STRCPY 3 .Dt STRCPY 3
.Os .Os
.Sh NAME .Sh NAME
@ -77,6 +77,12 @@ if the length of
.Fa src .Fa src
is greater than or equal to is greater than or equal to
.Fa len . .Fa len .
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES .Sh RETURN VALUES
The The
.Fn strcpy .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> .\" 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 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: July 16 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt STRLCPY 3 .Dt STRLCPY 3
.Os .Os
.Sh NAME .Sh NAME
@ -80,6 +80,12 @@ as it means that either
is incorrect or that is incorrect or that
.Fa dst .Fa dst
is not a proper string). is not a proper string).
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES .Sh RETURN VALUES
Besides quibbles over the return type Besides quibbles over the return type
.Pf ( Va size_t .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. .\" Copyright (c) 1990, 1991 The Regents of the University of California.
.\" All rights reserved. .\" All rights reserved.
@ -31,7 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.Dd $Mdocdate: June 5 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt WCSCPY 3 .Dt WCSCPY 3
.Os .Os
.Sh NAME .Sh NAME
@ -77,6 +77,12 @@ if the length of
.Fa src .Fa src
is greater than or equal to is greater than or equal to
.Fa len . .Fa len .
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES .Sh RETURN VALUES
The The
.Fn wcscpy .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> .\" 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 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: July 16 2013 $
.Dd $Mdocdate: September 25 2013 $
.Dt WCSLCPY 3 .Dt WCSLCPY 3
.Os .Os
.Sh NAME .Sh NAME
@ -88,6 +88,12 @@ It will append at most
.Fa size .Fa size
\(mi wcslen(dst) \(mi 1 wide characters, terminating the result with a null \(mi wcslen(dst) \(mi 1 wide characters, terminating the result with a null
wide character. wide character.
.Pp
If the
.Fa src
and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES .Sh RETURN VALUES
The The
.Fn wcslcpy .Fn wcslcpy


Loading…
Cancel
Save