wh_client: fix: cap labelSz and add defensive NULL checks#234
Merged
billphipps merged 1 commit intowolfSSL:mainfrom Dec 12, 2025
Merged
wh_client: fix: cap labelSz and add defensive NULL checks#234billphipps merged 1 commit intowolfSSL:mainfrom
billphipps merged 1 commit intowolfSSL:mainfrom
Conversation
Cap label size before copying and store the capped length in the request structure. Initialize request label length to zero and add a defensive null pointer check before copying in the DMA path. Fix two configuration output assignments returned by comm info. Rationale: prevent sending mismatched length fields and avoid potential null-dereference or buffer over-read. Signed-off-by: Badr Bacem KAABIA <badrbacemkaabia@gmail.com>
|
Can one of the admins verify this patch? |
bigbrett
approved these changes
Nov 11, 2025
Contributor
bigbrett
left a comment
There was a problem hiding this comment.
The variable name fix was necessary, the original code clearly contained a copy-paste error.
The criticality of the label length fix is overstated, as there is no possibility of buffer overflow, since the server truncates the label length sent by the client or returns error depending on the context. That said the fix is innocuous and it doesn't hurt to check it on the client side.
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.
This PR addresses two related issues in
wh_client.c:It fixes a potential buffer overflow in key cache request functions (
wh_Client_KeyCacheRequest_exandwh_Client_KeyCacheDmaRequest) by ensuring that the key label size is always capped atWH_NVM_LABEL_LENbefore copying it into the request structure and setting the size field (req->labelSz).It corrects a variable name logic error in
wh_Client_CommInfoResponsewhere the output parameters for "big" key cache configuration were incorrectly using the same variable check as the standard key cache configuration.