This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Bug in Newlib's sscanf implementation
- From: Niklas Eklund <eklund dot n at gmail dot com>
- To: newlib at sourceware dot org
- Date: Fri, 9 Mar 2018 16:13:19 +0100
- Subject: Bug in Newlib's sscanf implementation
- Authentication-results: sourceware.org; auth=none
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