sock_dns: correctly report too short messages#10896
Merged
miri64 merged 1 commit intoRIOT-OS:masterfrom Jan 29, 2019
Merged
Conversation
f75b654 to
20bcc16
Compare
kaspar030
reviewed
Jan 29, 2019
Contributor
|
LGTM, pls squash! |
1e47c6c to
b30cdb5
Compare
Member
Author
|
Squashed |
Member
Author
|
Backport provided in #10900 |
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
While writing the tests I promised in #10740 I noticed this bug.
sock_dns_query()returns the length of a too short DNS response instead of just reporting that it is wrong. While this is not severe, it can lead to confusing behavior, as the function does not report an error but just a number>0. This basically means,sock_dns_query()will tell the user that the address is whatever currently is on the stack ;-).Testing procedure
After the interface configuration described in the README of
tests/gnrc_sock_dnsstart the application (but not thednsmasq) and the following command in a separate terminalWithout this PR the response the output will be
With it correctly reports
Issues/PRs references
None, but found while working on https://github.com/miri64/RIOT/tree/tests/enh/gnrc_sock_dns/tests/gnrc_sock_dns