diff options
author | millert <> | 2013-09-25 21:49:31 +0000 |
---|---|---|
committer | millert <> | 2013-09-25 21:49:31 +0000 |
commit | d43fbdbe15661679852f61d404fabacd5aa30b48 (patch) | |
tree | e6b591457634e0ef31f70790dd43eb3915ca4b04 /src | |
parent | 2d453f9cfc595e35f9eb087dd002625195c31659 (diff) | |
download | openbsd-d43fbdbe15661679852f61d404fabacd5aa30b48.tar.gz openbsd-d43fbdbe15661679852f61d404fabacd5aa30b48.tar.bz2 openbsd-d43fbdbe15661679852f61d404fabacd5aa30b48.zip |
According to POSIX, if the src and dst strings overlap, the behavior
is undefined. Add a warning to that effect. OK deraadt@ jmc@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/string/memccpy.3 | 10 | ||||
-rw-r--r-- | src/lib/libc/string/stpcpy.3 | 10 | ||||
-rw-r--r-- | src/lib/libc/string/strcpy.3 | 10 | ||||
-rw-r--r-- | src/lib/libc/string/strlcpy.3 | 10 | ||||
-rw-r--r-- | src/lib/libc/string/wcscpy.3 | 10 | ||||
-rw-r--r-- | src/lib/libc/string/wcslcpy.3 | 10 |
6 files changed, 48 insertions, 12 deletions
diff --git a/src/lib/libc/string/memccpy.3 b/src/lib/libc/string/memccpy.3 index 076e8f64ab..98326d6871 100644 --- a/src/lib/libc/string/memccpy.3 +++ b/src/lib/libc/string/memccpy.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: memccpy.3,v 1.11 2013/06/05 03:39:23 tedu Exp $ | 1 | .\" $OpenBSD: memccpy.3,v 1.12 2013/09/25 21:49:30 millert Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1990, 1991, 1993 | 3 | .\" Copyright (c) 1990, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
@@ -29,7 +29,7 @@ | |||
29 | .\" | 29 | .\" |
30 | .\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93 | 30 | .\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93 |
31 | .\" | 31 | .\" |
32 | .Dd $Mdocdate: June 5 2013 $ | 32 | .Dd $Mdocdate: September 25 2013 $ |
33 | .Dt MEMCCPY 3 | 33 | .Dt MEMCCPY 3 |
34 | .Os | 34 | .Os |
35 | .Sh NAME | 35 | .Sh NAME |
@@ -60,6 +60,12 @@ is returned. | |||
60 | Otherwise, | 60 | Otherwise, |
61 | .Fa len | 61 | .Fa len |
62 | bytes are copied, and a null pointer is returned. | 62 | bytes are copied, and a null pointer is returned. |
63 | .Pp | ||
64 | If the | ||
65 | .Fa src | ||
66 | and | ||
67 | .Fa dst | ||
68 | strings overlap, the behavior is undefined. | ||
63 | .Sh SEE ALSO | 69 | .Sh SEE ALSO |
64 | .Xr bcopy 3 , | 70 | .Xr bcopy 3 , |
65 | .Xr memcpy 3 , | 71 | .Xr memcpy 3 , |
diff --git a/src/lib/libc/string/stpcpy.3 b/src/lib/libc/string/stpcpy.3 index ed1b830b56..ea25610717 100644 --- a/src/lib/libc/string/stpcpy.3 +++ b/src/lib/libc/string/stpcpy.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: stpcpy.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ | 1 | .\" $OpenBSD: stpcpy.3,v 1.4 2013/09/25 21:49:31 millert Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. | 3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
@@ -31,7 +31,7 @@ | |||
31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | .\" SUCH DAMAGE. | 32 | .\" SUCH DAMAGE. |
33 | .\" | 33 | .\" |
34 | .Dd $Mdocdate: June 5 2013 $ | 34 | .Dd $Mdocdate: September 25 2013 $ |
35 | .Dt STPCPY 3 | 35 | .Dt STPCPY 3 |
36 | .Os | 36 | .Os |
37 | .Sh NAME | 37 | .Sh NAME |
@@ -77,6 +77,12 @@ if the length of | |||
77 | .Fa src | 77 | .Fa src |
78 | is greater than or equal to | 78 | is greater than or equal to |
79 | .Fa len . | 79 | .Fa len . |
80 | .Pp | ||
81 | If the | ||
82 | .Fa src | ||
83 | and | ||
84 | .Fa dst | ||
85 | strings overlap, the behavior is undefined. | ||
80 | .Sh RETURN VALUES | 86 | .Sh RETURN VALUES |
81 | The | 87 | The |
82 | .Fn stpcpy | 88 | .Fn stpcpy |
diff --git a/src/lib/libc/string/strcpy.3 b/src/lib/libc/string/strcpy.3 index 409f4c61d4..798c7e8d99 100644 --- a/src/lib/libc/string/strcpy.3 +++ b/src/lib/libc/string/strcpy.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: strcpy.3,v 1.18 2013/07/17 05:42:11 schwarze Exp $ | 1 | .\" $OpenBSD: strcpy.3,v 1.19 2013/09/25 21:49:31 millert Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. | 3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
@@ -31,7 +31,7 @@ | |||
31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | .\" SUCH DAMAGE. | 32 | .\" SUCH DAMAGE. |
33 | .\" | 33 | .\" |
34 | .Dd $Mdocdate: July 17 2013 $ | 34 | .Dd $Mdocdate: September 25 2013 $ |
35 | .Dt STRCPY 3 | 35 | .Dt STRCPY 3 |
36 | .Os | 36 | .Os |
37 | .Sh NAME | 37 | .Sh NAME |
@@ -77,6 +77,12 @@ if the length of | |||
77 | .Fa src | 77 | .Fa src |
78 | is greater than or equal to | 78 | is greater than or equal to |
79 | .Fa len . | 79 | .Fa len . |
80 | .Pp | ||
81 | If the | ||
82 | .Fa src | ||
83 | and | ||
84 | .Fa dst | ||
85 | strings overlap, the behavior is undefined. | ||
80 | .Sh RETURN VALUES | 86 | .Sh RETURN VALUES |
81 | The | 87 | The |
82 | .Fn strcpy | 88 | .Fn strcpy |
diff --git a/src/lib/libc/string/strlcpy.3 b/src/lib/libc/string/strlcpy.3 index a0028a52b1..a7cd269819 100644 --- a/src/lib/libc/string/strlcpy.3 +++ b/src/lib/libc/string/strlcpy.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: strlcpy.3,v 1.24 2013/07/16 15:21:11 schwarze Exp $ | 1 | .\" $OpenBSD: strlcpy.3,v 1.25 2013/09/25 21:49:31 millert Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> | 3 | .\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> |
4 | .\" | 4 | .\" |
@@ -14,7 +14,7 @@ | |||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | .\" | 16 | .\" |
17 | .Dd $Mdocdate: July 16 2013 $ | 17 | .Dd $Mdocdate: September 25 2013 $ |
18 | .Dt STRLCPY 3 | 18 | .Dt STRLCPY 3 |
19 | .Os | 19 | .Os |
20 | .Sh NAME | 20 | .Sh NAME |
@@ -80,6 +80,12 @@ as it means that either | |||
80 | is incorrect or that | 80 | is incorrect or that |
81 | .Fa dst | 81 | .Fa dst |
82 | is not a proper string). | 82 | is not a proper string). |
83 | .Pp | ||
84 | If the | ||
85 | .Fa src | ||
86 | and | ||
87 | .Fa dst | ||
88 | strings overlap, the behavior is undefined. | ||
83 | .Sh RETURN VALUES | 89 | .Sh RETURN VALUES |
84 | Besides quibbles over the return type | 90 | Besides quibbles over the return type |
85 | .Pf ( Va size_t | 91 | .Pf ( Va size_t |
diff --git a/src/lib/libc/string/wcscpy.3 b/src/lib/libc/string/wcscpy.3 index c366103565..2277eb419a 100644 --- a/src/lib/libc/string/wcscpy.3 +++ b/src/lib/libc/string/wcscpy.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: wcscpy.3,v 1.3 2013/06/05 03:39:23 tedu Exp $ | 1 | .\" $OpenBSD: wcscpy.3,v 1.4 2013/09/25 21:49:31 millert Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. | 3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
4 | .\" All rights reserved. | 4 | .\" All rights reserved. |
@@ -31,7 +31,7 @@ | |||
31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
32 | .\" SUCH DAMAGE. | 32 | .\" SUCH DAMAGE. |
33 | .\" | 33 | .\" |
34 | .Dd $Mdocdate: June 5 2013 $ | 34 | .Dd $Mdocdate: September 25 2013 $ |
35 | .Dt WCSCPY 3 | 35 | .Dt WCSCPY 3 |
36 | .Os | 36 | .Os |
37 | .Sh NAME | 37 | .Sh NAME |
@@ -77,6 +77,12 @@ if the length of | |||
77 | .Fa src | 77 | .Fa src |
78 | is greater than or equal to | 78 | is greater than or equal to |
79 | .Fa len . | 79 | .Fa len . |
80 | .Pp | ||
81 | If the | ||
82 | .Fa src | ||
83 | and | ||
84 | .Fa dst | ||
85 | strings overlap, the behavior is undefined. | ||
80 | .Sh RETURN VALUES | 86 | .Sh RETURN VALUES |
81 | The | 87 | The |
82 | .Fn wcscpy | 88 | .Fn wcscpy |
diff --git a/src/lib/libc/string/wcslcpy.3 b/src/lib/libc/string/wcslcpy.3 index a976654ccc..7af6c74614 100644 --- a/src/lib/libc/string/wcslcpy.3 +++ b/src/lib/libc/string/wcslcpy.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: wcslcpy.3,v 1.5 2013/07/16 15:21:11 schwarze Exp $ | 1 | .\" $OpenBSD: wcslcpy.3,v 1.6 2013/09/25 21:49:31 millert Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> | 3 | .\" Copyright (c) 1998, 2000 Todd C. Miller <Todd.Miller@courtesan.com> |
4 | .\" | 4 | .\" |
@@ -14,7 +14,7 @@ | |||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | .\" | 16 | .\" |
17 | .Dd $Mdocdate: July 16 2013 $ | 17 | .Dd $Mdocdate: September 25 2013 $ |
18 | .Dt WCSLCPY 3 | 18 | .Dt WCSLCPY 3 |
19 | .Os | 19 | .Os |
20 | .Sh NAME | 20 | .Sh NAME |
@@ -88,6 +88,12 @@ It will append at most | |||
88 | .Fa size | 88 | .Fa size |
89 | \(mi wcslen(dst) \(mi 1 wide characters, terminating the result with a null | 89 | \(mi wcslen(dst) \(mi 1 wide characters, terminating the result with a null |
90 | wide character. | 90 | wide character. |
91 | .Pp | ||
92 | If the | ||
93 | .Fa src | ||
94 | and | ||
95 | .Fa dst | ||
96 | strings overlap, the behavior is undefined. | ||
91 | .Sh RETURN VALUES | 97 | .Sh RETURN VALUES |
92 | The | 98 | The |
93 | .Fn wcslcpy | 99 | .Fn wcslcpy |