This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12701] scanf accepts non-matching input
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Mon, 2 May 2011 02:35:58 +0000
- Subject: [Bug libc/12701] scanf accepts non-matching input
- Auto-submitted: auto-generated
- References: <bug-12701-131@http.sourceware.org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=12701
Rich Felker <bugdal at aerifal dot cx> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |
--- Comment #2 from Rich Felker <bugdal at aerifal dot cx> 2011-05-02 02:35:40 UTC ---
They are not correctly handled. Please refer to C99, 7.19.6.2, paragraph 9,
which defines an input item as:
"the longest sequence of input characters which does not exceed any speciïed
ïeld width and which is, or is a preïx of, a matching input sequence"
Paragraph 10 then reads:
"If the input item is not a matching sequence, the execution of the directive
fails: this condition is a matching failure."
Clearly in the case of sscanf("0xz", "%x%c", &x, &c), the first "input item" is
"0x", and it is not a matching sequence for the %x conversion (see the
specification of strtoul, in terms of which scanf %x is specified), so the
result must be a matching failure.
If you're going to wrongly mark this bug as "RESOLVED", at least mark it
"WONTFIX" rather than "INVALID" and acknowledge that it's a bug that you're
unwilling to fix, and that glibc is intentionally non-conformant in this
matter.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.