This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug stdio/18246] scanf "%2d" can incorrectly parse "0x" same for "%2f" with "1e"
- From: "nszabolcs at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 20 Apr 2015 10:18:50 +0000
- Subject: [Bug stdio/18246] scanf "%2d" can incorrectly parse "0x" same for "%2f" with "1e"
- Auto-submitted: auto-generated
- References: <bug-18246-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18246
--- Comment #2 from Szabolcs Nagy <nszabolcs at gmail dot com> ---
sorry the bug report was wrong: it should say %2i not %2d
the behaviour of %d is correct, but the result with %i is the same and that's a
conformance bug, because then 0x is a valid prefix.
the testcase should be:
#include <stdio.h>
int main()
{
int x;
int r;
r = sscanf("0x12", "%2i", &x);
if (r != 0)
printf("got %d fields (x=%d), expected 0\n", r, x);
}
--
You are receiving this mail because:
You are on the CC list for the bug.