-
Notifications
You must be signed in to change notification settings - Fork 2k
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
tests/gnrc_udp: Replace atoi() by strtol() [backport 2019.04] #11357
Conversation
Let's discuss the fix first before backporting it ;-). Otherwise, you just have more work, when you have to backport your fixups ;) |
(also when you backport after merge you can use the convenient backporting script) |
@miri64 I removed all of the changes that were unrelated to the Zero-length bug.
Actually, I forward-ported. I first made the change in the release branch and afterwards cherry-picked to master. |
Can you apply the changes here to master then, please, so we can merge there first? |
@jcarrano ping: Please adapt your backport. Also needs rebase. |
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.
ACK. Identical to #11356 and still working. Still needs rebase though.
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.
Re-ACK
This patch is a reduced version of an earlier one, with the bare minimum required to be able to run the test and get the release going. Original description: atoi() cannot detect errors. Many implementation return zero on error and that is what was being checked here, making the "udp send" command unable to parse integer values of zero. On top of this, the behavior on errors does not seem to be specified in the standard (so it is not even correct to check for zero even when zero is not an accepted value, like for a port number). The result of all this is that sending UDP packets of zero length (as required by the Release Specs) was not possible. This patch replaces atoi by strlen, which allows for robust error detection. Sending zero length packets is possible.
This was causing the CI build to fail in the static-check stage (cppcheck).
Contribution description
Partial backport of #11356 (only the bare minimum required to get the tests going.)
Issues/PRs references
See #11356 .