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

Fix IPv4 address parsing due to not-so-portable scanf modifier #6524

Merged
merged 1 commit into from Apr 6, 2018

Conversation

Projects
None yet
4 participants
@forGGe
Contributor

forGGe commented Apr 2, 2018

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

Fix IPv4 address parsing due to not-so-portable scanf modifier
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.

@0xc0170 0xc0170 requested a review from kjbracey-arm Apr 3, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Apr 3, 2018

Thanks @forGGe for the report and fix. Can you please sign https://os.mbed.com/contributor_agreement/ ?

@forGGe

This comment has been minimized.

Contributor

forGGe commented Apr 3, 2018

Thanks @forGGe for the report and fix. Can you please sign https://os.mbed.com/contributor_agreement/ ?

Done.

https://os.mbed.com/users/forGGe/

@kjbracey-arm

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.

@forGGe

This comment has been minimized.

Contributor

forGGe commented Apr 3, 2018

Thanks for approving! Let me know if you need something here (I see jenkins is failing, dunno why).

@0xc0170

0xc0170 approved these changes Apr 4, 2018

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Apr 4, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Apr 4, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Apr 4, 2018

Build : SUCCESS

Build number : 1661
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6524/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Apr 5, 2018

/morph mbed2-build

@0xc0170 0xc0170 merged commit f5385e7 into ARMmbed:master Apr 6, 2018

11 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 9059 cycles (-64 cycles)
Details
travis-ci/littlefs Passed, code size is 10092B (+0.00%)
Details
travis-ci/tools Local tools testing has passed
Details

@0xc0170 0xc0170 removed the ready for merge label Apr 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment