Skip to content

Prevent out-of-bounds header protection sample reads - #6310

Open
SanthoshShetty (Santhosha-bk) wants to merge 1 commit into
mainfrom
santhoshab/ShortHeaderfix
Open

Prevent out-of-bounds header protection sample reads#6310
SanthoshShetty (Santhosha-bk) wants to merge 1 commit into
mainfrom
santhoshab/ShortHeaderfix

Conversation

@Santhosha-bk

Copy link
Copy Markdown
Contributor

Description

For unencrypted short-header packets, MsQuic does not compute a header protection mask. However, it still copied a header-protection sample from the packet, which could read beyond the packet buffer.

This change copies the sample only when header protection is needed. Otherwise, it clears the sample buffer. Encrypted and long-header packet processing remains unchanged.

https://microsoft.visualstudio.com/OS/_workitems/edit/62259370/

Testing

Documentation

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.30%. Comparing base (ceba4ec) to head (21e1473).

Files with missing lines Patch % Lines
src/core/connection.c 75.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (75.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6310      +/-   ##
==========================================
- Coverage   85.96%   85.30%   -0.67%     
==========================================
  Files          60       60              
  Lines       18976    18979       +3     
==========================================
- Hits        16313    16190     -123     
- Misses       2663     2789     +126     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/core/connection.c
// For unencrypted short header packets, no header protection mask will be computed,
// so avoid reading an HP sample that may extend beyond the packet.
//
CxPlatZeroMemory(Cipher, CXPLAT_HP_SAMPLE_LENGTH);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do we expect to see unencrypted short header packets? When a connection negotiates the no-encryption custom transport parameter?

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