summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2019-01-16 12:55:49 +0000
committerschwarze <schwarze@openbsd.org>2019-01-16 12:55:49 +0000
commita41d0f37be18caa1a290a21e618cbb06c70ee94f (patch)
treedb73e6e13029f72037ea6bb86bdbbd0f716d0283
parentinclude pf.h for #if NPF > 0 test (diff)
downloadwireguard-openbsd-a41d0f37be18caa1a290a21e618cbb06c70ee94f.tar.xz
wireguard-openbsd-a41d0f37be18caa1a290a21e618cbb06c70ee94f.zip
For all functions known to be infected by LC_NUMERIC, add short
CAVEATS pointing to the new CAVEATS section in setlocale(3). Make those in wprintf(3) and wscanf(3) more concise since duplicate information is a bad idea. Incompleteness of information originally pointed out by millert@. OK millert@
-rw-r--r--lib/libc/locale/wcstod.313
-rw-r--r--lib/libc/stdio/printf.313
-rw-r--r--lib/libc/stdio/scanf.313
-rw-r--r--lib/libc/stdio/wprintf.317
-rw-r--r--lib/libc/stdio/wscanf.316
-rw-r--r--lib/libc/stdlib/atof.313
-rw-r--r--lib/libc/stdlib/strtod.313
7 files changed, 63 insertions, 35 deletions
diff --git a/lib/libc/locale/wcstod.3 b/lib/libc/locale/wcstod.3
index ed3fedce03d..b9078775633 100644
--- a/lib/libc/locale/wcstod.3
+++ b/lib/libc/locale/wcstod.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: wcstod.3,v 1.2 2010/09/10 18:38:19 jmc Exp $
+.\" $OpenBSD: wcstod.3,v 1.3 2019/01/16 12:55:49 schwarze Exp $
.\" $NetBSD: wcstod.3,v 1.5 2007/05/21 15:29:51 tnozaki Exp $
.\"
.\" Copyright (c) 2002, 2003 Tim J. Robbins
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD: wcstod.3,v 1.4 2003/05/22 13:02:27 ru Exp $
.\"
-.Dd $Mdocdate: September 10 2010 $
+.Dd $Mdocdate: January 16 2019 $
.Dt WCSTOD 3
.Os
.Sh NAME
@@ -72,3 +72,12 @@ and
.Fn wcstold
functions conform to
.St -isoC-99 .
+.Sh CAVEATS
+On systems other than
+.Ox ,
+the
+.Dv LC_NUMERIC
+.Xr locale 1
+category can cause parsing failures; see CAVEATS in
+.Xr setlocale 3
+for details.
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index 1fc1618b29f..236c7dbc6fd 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: printf.3,v 1.78 2018/01/02 08:05:03 jmc Exp $
+.\" $OpenBSD: printf.3,v 1.79 2019/01/16 12:55:49 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: January 2 2018 $
+.Dd $Mdocdate: January 16 2019 $
.Dt PRINTF 3
.Os
.Sh NAME
@@ -888,3 +888,12 @@ parameters, up to the
last positionally specified parameter, are used in the format string.
This allows for the format string to be parsed for this information.
Failure to do this will mean the code is non-portable and liable to fail.
+.Pp
+On systems other than
+.Ox ,
+the
+.Dv LC_NUMERIC
+.Xr locale 1
+category can cause erratic output; see CAVEATS in
+.Xr setlocale 3
+for details.
diff --git a/lib/libc/stdio/scanf.3 b/lib/libc/stdio/scanf.3
index bcd156c5441..de75b931ce3 100644
--- a/lib/libc/stdio/scanf.3
+++ b/lib/libc/stdio/scanf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: scanf.3,v 1.23 2017/12/01 11:18:40 schwarze Exp $
+.\" $OpenBSD: scanf.3,v 1.24 2019/01/16 12:55:49 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" 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: December 1 2017 $
+.Dd $Mdocdate: January 16 2019 $
.Dt SCANF 3
.Os
.Sh NAME
@@ -459,6 +459,15 @@ and
.Fn vfscanf
in
.Bx 4.3 Reno .
+.Sh CAVEATS
+On systems other than
+.Ox ,
+the
+.Dv LC_NUMERIC
+.Xr locale 1
+category can cause parsing failures; see CAVEATS in
+.Xr setlocale 3
+for details.
.Sh BUGS
Numerical strings are truncated to 512 characters; for example,
.Cm %f
diff --git a/lib/libc/stdio/wprintf.3 b/lib/libc/stdio/wprintf.3
index 2914716e692..bc8dcc34407 100644
--- a/lib/libc/stdio/wprintf.3
+++ b/lib/libc/stdio/wprintf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: wprintf.3,v 1.6 2019/01/11 09:53:26 schwarze Exp $
+.\" $OpenBSD: wprintf.3,v 1.7 2019/01/16 12:55:49 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -33,7 +33,7 @@
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: January 11 2019 $
+.Dd $Mdocdate: January 16 2019 $
.Dt WPRINTF 3
.Os
.Sh NAME
@@ -607,15 +607,6 @@ On systems other than
the
.Dv LC_NUMERIC
.Xr locale 1
-category can cause erratic output, for example different characters
-substituted for the decimal point or thousands separator characters
-inserted into numbers.
-For security reasons, make sure that portable programs calling these
-functions never call
+category can cause erratic output; see CAVEATS in
.Xr setlocale 3
-with the
-.Dv LC_ALL
-or
-.Dv LC_NUMERIC
-categories but only use
-.Dv LC_CTYPE .
+for details.
diff --git a/lib/libc/stdio/wscanf.3 b/lib/libc/stdio/wscanf.3
index c423b3bf4fb..f6583718d14 100644
--- a/lib/libc/stdio/wscanf.3
+++ b/lib/libc/stdio/wscanf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: wscanf.3,v 1.3 2019/01/11 10:20:38 schwarze Exp $
+.\" $OpenBSD: wscanf.3,v 1.4 2019/01/16 12:55:49 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -34,7 +34,7 @@
.\" @(#)scanf.3 8.2 (Berkeley) 12/11/93
.\" FreeBSD: src/lib/libc/stdio/scanf.3,v 1.24 2003/06/28 09:03:25 das Exp
.\"
-.Dd $Mdocdate: January 11 2019 $
+.Dd $Mdocdate: January 16 2019 $
.Dt WSCANF 3
.Os
.Sh NAME
@@ -434,17 +434,9 @@ On systems other than
the
.Dv LC_NUMERIC
.Xr locale 1
-category can cause parsing failures, for example because it may cause
-a different character to be expected instead of the decimal point.
-For security reasons, make sure that portable programs calling
-these functions never call
+category can cause parsing failures; see CAVEATS in
.Xr setlocale 3
-with the
-.Dv LC_ALL
-or
-.Dv LC_NUMERIC
-categories but only use
-.Dv LC_CTYPE .
+for details.
.Sh BUGS
In addition to the bugs documented in
.Xr scanf 3 ,
diff --git a/lib/libc/stdlib/atof.3 b/lib/libc/stdlib/atof.3
index b520e2bc4a1..183f22d358d 100644
--- a/lib/libc/stdlib/atof.3
+++ b/lib/libc/stdlib/atof.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: atof.3,v 1.8 2015/09/10 15:16:43 schwarze Exp $
+.\" $OpenBSD: atof.3,v 1.9 2019/01/16 12:55:49 schwarze Exp $
.\"
-.Dd $Mdocdate: September 10 2015 $
+.Dd $Mdocdate: January 16 2019 $
.Dt ATOF 3
.Os
.Sh NAME
@@ -70,3 +70,12 @@ An
.Fn atof
function first appeared in
.At v1 .
+.Sh CAVEATS
+On systems other than
+.Ox ,
+the
+.Dv LC_NUMERIC
+.Xr locale 1
+category can cause parsing failures; see CAVEATS in
+.Xr setlocale 3
+for details.
diff --git a/lib/libc/stdlib/strtod.3 b/lib/libc/stdlib/strtod.3
index baca4b223f3..0561f3615d7 100644
--- a/lib/libc/stdlib/strtod.3
+++ b/lib/libc/stdlib/strtod.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: strtod.3,v 1.21 2016/06/02 15:07:34 millert Exp $
+.\" $OpenBSD: strtod.3,v 1.22 2019/01/16 12:55:49 schwarze Exp $
.\"
-.Dd $Mdocdate: June 2 2016 $
+.Dd $Mdocdate: January 16 2019 $
.Dt STRTOD 3
.Os
.Sh NAME
@@ -165,3 +165,12 @@ and
.Fn strtold
functions conform to
.St -isoC-99 .
+.Sh CAVEATS
+On systems other than
+.Ox ,
+the
+.Dv LC_NUMERIC
+.Xr locale 1
+category can cause parsing failures; see CAVEATS in
+.Xr setlocale 3
+for details.