This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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 in Newlib's sscanf implementation


Hello.

In sscanf with following buffer to parse "0x0000" and format string "%x
%n", does not return expected result.

It is the value given by %n variable that is off-by-one (value is 5 instead
of expected 6). The value given by %x is correctly set to zero.

If the buffer to parse is any other value than just zeros, or without
leading 0x, it gives expected results. I think it might be the
NDIGITS/NZDIGITS/NNZDIGITS toggling that might throw of the increasing of
number of characters parsed. Or it is some final criteria that kicks in if
0x has been found and then only zeros.

Best regards.

Niklas Eklund


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