Skip to content

Prevent header NV allocation size overflow - #547

Open
freedom-winds wants to merge 1 commit into
ngtcp2:mainfrom
freedom-winds:pr/01-nva-copy-overflow-20260811185650-01
Open

Prevent header NV allocation size overflow#547
freedom-winds wants to merge 1 commit into
ngtcp2:mainfrom
freedom-winds:pr/01-nva-copy-overflow-20260811185650-01

Conversation

@freedom-winds

Copy link
Copy Markdown

Summary

Add overflow checks to nghttp3_nva_copy before allocating storage for copied header names, values, and the NV array.

Details

nghttp3_nva_copy previously accumulated allocation sizes without checking integer overflow. Crafted namelen, valuelen, or nvlen values could wrap the calculated size, resulting in an undersized allocation followed by out-of-bounds memory writes during header copying.

This patch:

  • Checks name-length and value-length additions.
  • Checks nvlen * sizeof(nghttp3_nv).
  • Checks the final allocation-size addition.
  • Returns NGHTTP3_ERR_INVALID_ARGUMENT for overflowing inputs.

Validation

The modified source passes compiler syntax validation with -Wall -Wextra -Werror.

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.

1 participant