-
Notifications
You must be signed in to change notification settings - Fork 8k
Ckhardin/fix inet ntop buffer size #96945
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
Open
ckhardin
wants to merge
2
commits into
zephyrproject-rtos:main
Choose a base branch
from
ckhardin:ckhardin/fix-inet-ntop-buffer-size
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ckhardin/fix inet ntop buffer size #96945
ckhardin
wants to merge
2
commits into
zephyrproject-rtos:main
from
ckhardin:ckhardin/fix-inet-ntop-buffer-size
+27
−15
Conversation
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
caf7d87
to
7d0c800
Compare
From the manpage for inet_ntop This function converts the network address structure src in the af address family into a character string. The resulting string is copied to the buffer pointed to by dst, which must be a non-null pointer. The caller specifies the number of bytes available in this buffer in the argument size. In an unintended misconfiguration the resolve max string ended up being 20 and tracking thru some wierd code issues determined some stack corruption which came back to the shell command. So, just fix the size argument to be the sizeof which then leads to the next problem that the size is being ignored by inet_ntop. Signed-off-by: Charles Hardin <[email protected]>
7d0c800
to
b33041e
Compare
jukkar
reviewed
Oct 3, 2025
8361ffe
to
0a43f16
Compare
dbef1ae
to
ad4fbc7
Compare
The code was writing to the dst without a verification check on size which is not appropriate. The guard on the arguements should be enforced and so just ensure the size is larger then the definition of the strings from POSIX and return an error in those cases. Signed-off-by: Charles Hardin <[email protected]>
ad4fbc7
to
25bab1c
Compare
|
jukkar
approved these changes
Oct 5, 2025
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.
Thanks, I think this is good so we avoid increasing stack usage too much.
rlubos
approved these changes
Oct 6, 2025
pdgendt
approved these changes
Oct 6, 2025
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.
Deal with some issues found during a misconfiguration of the DNS resolver that ended up leading into a problem in the base inet_ntop implementation not checking the bounds of the passed in buffer and overwriting the passed in dst.