Skip to content

Various fixes#10142

Merged
JacobBarthelmeh merged 8 commits intowolfSSL:masterfrom
kareem-wolfssl:variousFixes2
Apr 23, 2026
Merged

Various fixes#10142
JacobBarthelmeh merged 8 commits intowolfSSL:masterfrom
kareem-wolfssl:variousFixes2

Conversation

@kareem-wolfssl
Copy link
Copy Markdown
Contributor

Description

Fix multiple missing bounds and length checks.

Fixes zd#21536, zd#21537, zd#21538, zd#21540, zd#21541

Testing

Built in tests, provided reproducers

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@kareem-wolfssl kareem-wolfssl self-assigned this Apr 6, 2026
Copilot AI review requested due to automatic review settings April 6, 2026 22:53
@kareem-wolfssl kareem-wolfssl added the For This Release Release version 5.9.1 label Apr 6, 2026
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Fixes multiple missing bounds/length checks across TLS 1.3 handshake, OCSP processing, and sniffer ClientHello parsing to prevent out-of-bounds reads/writes and invalid-length parsing.

Changes:

  • Added maximum certificate extension count guards in TLS 1.3 certificate/OCSP flows.
  • Added minimum-length checks before reading OPAQUE16-sized fields from buffers.
  • Improved error return behavior/documentation for certificate status request buffer writing.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/tls13.c Adds MAX_CERT_EXTENSIONS bounds checks around CSR-to-buffer writing and TLS 1.3 certificate sending.
src/tls.c Adds OPAQUE16 minimum-length validation and caps OCSP request processing to MAX_CERT_EXTENSIONS.
src/sniffer.c Adds OPAQUE16 minimum-length validation for several ClientHello extensions.
src/internal.c Adds MAX_CERT_EXTENSIONS bounds checks while generating/sending OCSP status responses.
Comments suppressed due to low confidence (1)

src/internal.c:1

  • This loop can still read past the end of chainOcspRequest because i is incremented inside &responses[++i]. After the last valid increment, the next while condition evaluates ssl->ctx->chainOcspRequest[i] with i == MAX_CERT_EXTENSIONS, causing an out-of-bounds read before the in-loop bounds check runs. Refactor to avoid pre-increment in the call (increment i separately after a bounds check) and ensure the bounds check occurs before any chainOcspRequest[i] dereference.

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

Comment thread src/sniffer.c Outdated
Comment thread src/sniffer.c Outdated
Comment thread src/tls13.c Outdated
Comment thread src/tls.c Outdated
@JacobBarthelmeh JacobBarthelmeh removed the For This Release Release version 5.9.1 label Apr 7, 2026
Copilot AI review requested due to automatic review settings April 7, 2026 17:26
Copy link
Copy Markdown
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/internal.c:1

  • The bounds check happens after indexing ssl->ctx->chainOcspRequest[i], so if i is already >= MAX_CERT_EXTENSIONS this can read out-of-bounds before the new guard runs. Move/adjust the check to validate i < MAX_CERT_EXTENSIONS before evaluating ssl->ctx->chainOcspRequest[i] (e.g., incorporate it into the while condition or add a pre-check before the assignment).

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

Comment thread src/sniffer.c
Comment thread src/sniffer.c
…GetFromBuffer.

Thanks to Zou Dikai for the report.
…riteCSRToBuffer.

Thanks to Zou Dikai for the report.
… to read the length before attempting the actual read.

Thanks to Zou Dikai for the report.
Copilot AI review requested due to automatic review settings April 15, 2026 17:53
Copy link
Copy Markdown
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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


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

Comment thread src/tls.c
Comment thread src/sniffer.c
Comment thread src/tls.c
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 15, 2026

MemBrowse Memory Report

gcc-arm-cortex-m4

  • FLASH: .text +64 B (+0.0%, 195,275 B / 262,144 B, total: 74% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +64 B (+0.1%, 63,539 B / 262,144 B, total: 24% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +64 B (+0.1%, 59,125 B / 262,144 B, total: 23% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +64 B (+0.1%, 119,418 B / 262,144 B, total: 46% used)

…ays equal 1 + MAX_CHAIN_DEPTH, and the latter is the length of the array.
@JacobBarthelmeh JacobBarthelmeh merged commit 90366b7 into wolfSSL:master Apr 23, 2026
435 checks passed
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.

4 participants