Skip to content

Fix a couple of issues in DTLS ClientHello parsing. - #11007

Open
kareem-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
kareem-wolfssl:zd22219
Open

Fix a couple of issues in DTLS ClientHello parsing.#11007
kareem-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
kareem-wolfssl:zd22219

Conversation

@kareem-wolfssl

Copy link
Copy Markdown
Contributor

Thanks to the Fuzz0x team for the report.

Description

Fixes zd#22219

Testing

Provided reproducers + built in tests

Checklist

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

Thanks to the Fuzz0x team for the report.
@kareem-wolfssl kareem-wolfssl self-assigned this Jul 29, 2026
Copilot AI review requested due to automatic review settings July 29, 2026 22:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Tightens DTLS/TLS 1.3 ClientHello parsing to prevent out-of-bounds reads when consuming length-prefixed legacy fields (session_id and legacy_cookie), aligning error handling with fuzz-discovered edge cases.

Changes:

  • Added explicit bounds checks before reading opaque-8 length fields in DoTls13SupportedVersions.
  • Added bounds check and refactored cookieLen handling in DTLS DoTls13ClientHello parsing.

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

Comment thread src/tls13.c
Comment on lines +7338 to 7343
if (i + OPAQUE8_LEN > helloSz) {
return BUFFER_ERROR;
}
b = input[i++];
if (i + b > helloSz) {
return BUFFER_ERROR;
Comment thread src/tls13.c
Comment on lines +7349 to 7354
if (i + OPAQUE8_LEN > helloSz) {
return BUFFER_ERROR;
}
b = input[i++];
if (i + b > helloSz) {
return BUFFER_ERROR;
Comment thread src/tls13.c
Comment on lines +7725 to +7729
byte cookieLen;
if ((args->idx - args->begin) + OPAQUE8_LEN > helloSz)
ERROR_OUT(BUFFER_ERROR, exit_dch);
/* https://www.rfc-editor.org/rfc/rfc9147.html#section-5.3 */
byte cookieLen = input[args->idx++];
cookieLen = input[args->idx++];
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.

2 participants