-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix IPv4 address parsing due to not-so-portable scanf modifier #6524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Bug is raised when using newlib-based toolchains. %hh format is only avaliable in scanf if newlib is compiled with _WANT_IO_C99_FORMATS option.
Thanks @forGGe for the report and fix. Can you please sign https://os.mbed.com/contributor_agreement/ ? |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we are still sometimes using a newlib-nano that lacks C99 stuff. Very annoying - particularly due to lack of %llu for 64-bit.
Given that, this change is okay. Was going to nak it because I thought we were losing a 0-255 range check, but it turns out scanf
doesn't actually range check anyway - it's always just been undefined behaviour if out of range.
Thanks for approving! Let me know if you need something here (I see jenkins is failing, dunno why). |
/morph build |
Build : SUCCESSBuild number : 1661 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 1294 |
Test : SUCCESSBuild number : 1454 |
/morph mbed2-build |
Description
If newlib is compiled without C99 switch,
%hhu
will be missing. Newlib sources:https://github.com/eblot/newlib/blob/2a63fa0fd26ffb6603f69d9e369e944fe449c246/newlib/libc/stdio/vfscanf.c#L588-L596
Forum bug
Created as https://os.mbed.com/forum/bugs-suggestions/topic/30567/
Proceed there for more info.
Pull request type
[x] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change