public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug stdio/28932] New: scanf "%n" incorrectly requires int pointer, instead of size_t pointer
@ 2022-03-01 5:01 john.m.kenny at outlook dot com
2022-03-01 9:06 ` [Bug stdio/28932] " schwab@linux-m68k.org
0 siblings, 1 reply; 2+ messages in thread
From: john.m.kenny at outlook dot com @ 2022-03-01 5:01 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28932
Bug ID: 28932
Summary: scanf "%n" incorrectly requires int pointer, instead
of size_t pointer
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: stdio
Assignee: unassigned at sourceware dot org
Reporter: john.m.kenny at outlook dot com
Target Milestone: ---
The scanf function's conversion specifier "%n" requires the next pointer to be
a pointer to an int. That int gets "the number of characters consumed thus far
from the input". However, an int may not be large enough to read the number of
chars read.
Previous programmers have identified this issue and resolved it by using a
size_t. As evidence, the strlen(3) function returns a size_t and not an int.
The fix: make the require pointer for the "%n" conversion specifier a size_t
pointer instead of an int.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug stdio/28932] scanf "%n" incorrectly requires int pointer, instead of size_t pointer
2022-03-01 5:01 [Bug stdio/28932] New: scanf "%n" incorrectly requires int pointer, instead of size_t pointer john.m.kenny at outlook dot com
@ 2022-03-01 9:06 ` schwab@linux-m68k.org
0 siblings, 0 replies; 2+ messages in thread
From: schwab@linux-m68k.org @ 2022-03-01 9:06 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28932
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |NOTABUG
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
If you want to store a size_t, use %zn.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-01 9:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 5:01 [Bug stdio/28932] New: scanf "%n" incorrectly requires int pointer, instead of size_t pointer john.m.kenny at outlook dot com
2022-03-01 9:06 ` [Bug stdio/28932] " schwab@linux-m68k.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).