Apply checking of req_size in handlers#299
Open
padelsbach wants to merge 1 commit intowolfSSL:mainfrom
Open
Conversation
2e741ac to
fc0e2e2
Compare
bigbrett
requested changes
Mar 17, 2026
| (void)wh_MessageShe_TranslateSetUidRequest( | ||
| magic, (whMessageShe_SetUidRequest*)req_packet, &req); | ||
| if (req_size < sizeof(req)) { | ||
| ret = WH_ERROR_BUFFER_SIZE; |
Contributor
There was a problem hiding this comment.
I believe this leaks a non-SHE error code. This module can only return SHE errors. We have an error code translation function _TranslateSheReturnCode(). Check the rest of the code for similar issues plz.
Contributor
Author
There was a problem hiding this comment.
Good catch. Line 220 sets resp.rc = ret unlike the other functions. This is a pre-existing bug. Will fix
fc0e2e2 to
c0ee8d4
Compare
padelsbach
commented
Mar 18, 2026
| resp.rc = ret; | ||
| resp.rc = _TranslateSheReturnCode(ret); | ||
| (void)wh_MessageShe_TranslateSetUidResponse(magic, &resp, resp_packet); | ||
| *out_resp_size = sizeof(resp); |
Contributor
Author
There was a problem hiding this comment.
This was also a pre-existing issue. out_resp_size was not set by this handler
padelsbach
commented
Mar 18, 2026
| return WH_ERROR_BADARGS; | ||
| } | ||
|
|
||
| /* Use out_resp_size as the indicator of whether a response was generated |
Contributor
Author
There was a problem hiding this comment.
This change ensures the response is sent, even if a handler found an issue. Credit to Claude for this.
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.
Several functions in
wh_server_she.cignored the received payload length with(void)req_size;. This change adds size checking and associated unit tests.