Skip to content

Make sure size check doesn't underflow#9914

Merged
douzzer merged 1 commit intowolfSSL:masterfrom
julek-wolfssl:fenrir/30
Mar 7, 2026
Merged

Make sure size check doesn't underflow#9914
douzzer merged 1 commit intowolfSSL:masterfrom
julek-wolfssl:fenrir/30

Conversation

@julek-wolfssl
Copy link
Member

F-30

Copilot AI review requested due to automatic review settings March 6, 2026 16:24
@julek-wolfssl julek-wolfssl self-assigned this Mar 6, 2026
@julek-wolfssl julek-wolfssl added the For This Release Release version 5.9.0 label Mar 6, 2026
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

Prevents an unsigned-size underflow when computing TLS 1.3 plaintext size by guarding the subtraction with a bounds check.

Changes:

  • Adds a conditional check to ensure curSize - aead_mac_size is only computed when safe.
  • Keeps existing TLS 1.3 encrypted and plaintext maximum-size enforcement logic intact.
Comments suppressed due to low confidence (1)

src/internal.c:1

  • To make the intent clearer and avoid skipping the safe equality case, consider expressing the guard as if (ssl->curSize >= ssl->specs.aead_mac_size) (or equivalently if (ssl->curSize > ssl->specs.aead_mac_size) if you intentionally want to skip equality) and prefer comparing the left-hand side as curSize to match the subtraction order. This reduces cognitive load when reading the bounds check.

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

@douzzer douzzer added the Staged Staged for merge pending final test results and review label Mar 6, 2026
@douzzer douzzer merged commit 1d49f41 into wolfSSL:master Mar 7, 2026
450 of 453 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 Staged Staged for merge pending final test results and review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants