Skip to content

Conversation

@kaabia
Copy link

@kaabia kaabia commented Nov 8, 2025

This PR addresses two related issues in wh_client.c:

  1. It fixes a potential buffer overflow in key cache request functions (wh_Client_KeyCacheRequest_ex and wh_Client_KeyCacheDmaRequest) by ensuring that the key label size is always capped at WH_NVM_LABEL_LEN before copying it into the request structure and setting the size field (req->labelSz).

  2. It corrects a variable name logic error in wh_Client_CommInfoResponse where the output parameters for "big" key cache configuration were incorrectly using the same variable check as the standard key cache configuration.

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 <[email protected]>
@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

Copy link
Contributor

@bigbrett bigbrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bigbrett bigbrett assigned billphipps and unassigned bigbrett Nov 11, 2025
@bigbrett bigbrett requested a review from billphipps November 11, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants