sscanf %02x and "0x" behaviour
Bug #1829980 reported by
Zibri Soft
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
glibc (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
I wrote this routine to convert a hex string to binary:
The routine works nicely but I noticed one thing:
sscanf(
accepts:
1
02
Aa
aA
but it also accepts
0x which it translates to 00
There's no real harm in that, but I think that should be corrected.
In a loop if the input string (check my routine) is
"0x 0x 12 34 0x 1x 12 34"
The routine translates
00 00 12 34 00
Because for sscanf 0x is not an error but 1x is.
IMHO they should both be treated the same way in "%x"...
Regards,
Zibri
To post a comment you must log in.