quic: Fix buffer underflow#10838
Conversation
|
Can one of the admins verify this patch? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd8772ac3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| rl = (RecordLayerHeader*)output; | ||
| ato16(rl->length, &rlen); | ||
| output += RECORD_HEADER_SZ; | ||
| if (length < RECORD_HEADER_SZ) { |
There was a problem hiding this comment.
Move the short-header check before reading the header
When outputBuffer.length is 1–4 at the start of a QUIC TLS record, this guard runs only after ato16(rl->length, &rlen) has already read from output. That means the short-buffer path still performs an out-of-bounds read before returning FWRITE_ERROR, so the intended underflow fix doesn't protect truncated buffered records; please check length < RECORD_HEADER_SZ before casting/dereferencing rl.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR aims to fix a potential buffer underflow in the QUIC TLS record forwarding path (wolfSSL_quic_send_internal) by adding a size check before consuming a TLS record header.
Changes:
- Added a guard intended to prevent subtracting
RECORD_HEADER_SZfrom an undersized remaining buffer during QUIC send processing.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /* at start of a TLS Record */ | ||
| rl = (RecordLayerHeader*)output; | ||
| ato16(rl->length, &rlen); | ||
| output += RECORD_HEADER_SZ; | ||
| if (length < RECORD_HEADER_SZ) { |
ZD 21915