summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2023-02-05 15:36:07 +0100
committerAlejandro Colomar <alx@kernel.org>2023-02-05 15:36:46 +0100
commit1f9949d11f499e5758f7e213e528b022cd8ad8f1 (patch)
tree437a1d9eee10d9370ec6a1200f206290bca3c10c
parent3aabcc0f7dda611dc2d2e43ede0a7a27b82f9be5 (diff)
sscanf.3: BUGS: Document the UB in some conversion specifiers
This is a bug in the standards, but implementation should not follow the standard in this case. Link: <https://lore.kernel.org/linux-man/20221208123454.13132-1-abbotti@mev.co.uk/T/#u> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Zack Weinberg <zack@owlfolio.org> Cc: Joseph Myers <joseph@codesourcery.com> Cc: Eric Biggers <ebiggers@kernel.org> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--man3/sscanf.319
1 files changed, 19 insertions, 0 deletions
diff --git a/man3/sscanf.3 b/man3/sscanf.3
index 26a02521b..870c6f54b 100644
--- a/man3/sscanf.3
+++ b/man3/sscanf.3
@@ -653,6 +653,25 @@ floating-point conversion specifier (and is unaffected by
.I gcc\~\-std=c99
etc.).
.SH BUGS
+.SS Numeric conversion specifiers
+Use of the numeric conversion specifiers produces Undefined Behavior
+for invalid input.
+See
+.UR https://port70.net/\:%7Ensz/\:c/\:c11/\:n1570.html\:#7.21.6.2p10
+C11 7.21.6.2/10
+.UE .
+This is a bug in the ISO C standard,
+and not an inherent design issue with the API.
+However,
+current implementations are not safe from that bug,
+so it is not recommended to use them.
+Instead,
+programs should use functions such as
+.BR strtol (3)
+to parse numeric input.
+This manual page deprecates use of the numeric conversion specifiers
+until they are fixed by ISO C.
+.SS Nonstandard modifiers
These functions are fully C99 conformant, but provide the
additional modifiers
.B q