Skip to content

fix to sanity check on importing raw session key info#9973

Merged
dgarske merged 1 commit intowolfSSL:masterfrom
JacobBarthelmeh:static_analysis
Mar 16, 2026
Merged

fix to sanity check on importing raw session key info#9973
dgarske merged 1 commit intowolfSSL:masterfrom
JacobBarthelmeh:static_analysis

Conversation

@JacobBarthelmeh
Copy link
Contributor

No description provided.

@JacobBarthelmeh JacobBarthelmeh self-assigned this Mar 13, 2026
Copilot AI review requested due to automatic review settings March 13, 2026 21:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the bounds check when importing raw session key material to correctly account for skipping two chunks of size sz.

Changes:

  • Updates the length check from sz + idx to (sz * 2) + idx before advancing idx twice.
Comments suppressed due to low confidence (1)

src/internal.c:1

  • The updated check correctly accounts for two sz advances, but (sz * 2) + idx can overflow (and wrap) if sz/idx are unsigned, potentially bypassing the bounds check and leading to out-of-bounds reads later. Prefer an overflow-safe formulation (e.g., compare using division or subtract-first): check idx > len first (if not guaranteed elsewhere), then validate sz > (len - idx) / 2 (or equivalent) before doing idx += sz twice.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@JacobBarthelmeh JacobBarthelmeh added the For This Release Release version 5.9.0 label Mar 16, 2026
@JacobBarthelmeh
Copy link
Contributor Author

Retest this please Jenkins

@dgarske dgarske merged commit 77c7418 into wolfSSL:master Mar 16, 2026
474 of 475 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants