Fix a couple of issues in DTLS ClientHello parsing. - #11007
Open
kareem-wolfssl wants to merge 1 commit into
Open
Fix a couple of issues in DTLS ClientHello parsing.#11007kareem-wolfssl wants to merge 1 commit into
kareem-wolfssl wants to merge 1 commit into
Conversation
Thanks to the Fuzz0x team for the report.
Contributor
There was a problem hiding this comment.
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
cookieLenhandling in DTLSDoTls13ClientHelloparsing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 on lines
+7349
to
7354
| if (i + OPAQUE8_LEN > helloSz) { | ||
| return BUFFER_ERROR; | ||
| } | ||
| b = input[i++]; | ||
| if (i + b > helloSz) { | ||
| return BUFFER_ERROR; |
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++]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks to the Fuzz0x team for the report.
Description
Fixes zd#22219
Testing
Provided reproducers + built in tests
Checklist