This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug stdio/18246] scanf "%2d" can incorrectly parse "0x" same for "%2f" with "1e"


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]