tests/gnrc_udp: Replace atoi() by strtol() [backport 2019.04]#11357
Merged
miri64 merged 2 commits intoRIOT-OS:2019.04-branchfrom Apr 15, 2019
Merged
tests/gnrc_udp: Replace atoi() by strtol() [backport 2019.04]#11357miri64 merged 2 commits intoRIOT-OS:2019.04-branchfrom
miri64 merged 2 commits intoRIOT-OS:2019.04-branchfrom
Conversation
Member
|
Let's discuss the fix first before backporting it ;-). Otherwise, you just have more work, when you have to backport your fixups ;) |
Member
|
(also when you backport after merge you can use the convenient backporting script) |
Contributor
Author
|
@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. |
Member
Can you apply the changes here to master then, please, so we can merge there first? |
Member
|
@jcarrano ping: Please adapt your backport. Also needs rebase. |
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
Partial backport of #11356 (only the bare minimum required to get the tests going.)
Issues/PRs references
See #11356 .