Repository navigation
fix(protocols): refuse an empty raw option in the makers (#2723) - #2728
Merged
Merged
Conversation
A raw-octets item given to a maker had its code read, or was kept, before its length was checked, so an empty one escaped as a bare exception, was misread, or was dropped. - IPv4, HOPOPT, IPv6-Opts: _make_ipv4_options, _make_hopopt_options and _make_ipv6_opts read schema[0] of b'' and raised IndexError. - SCTP: _make_sctp_parameters and _make_sctp_causes kept b'', which reached read() as a schema and raised AttributeError. - PCAP-NG: _make_pcapng_options and _make_nrb_records read a 16-bit code from b'' as 0 and wrote an end marker; shorter-than-code octets are refused. - MH: _make_mh_options, the FID, ANI and LCMP sub-option makers, _make_qos_attributes and _make_cga_extensions kept b'', which raised AttributeError alone and was dropped beside another item. - DCCP, HIP: _make_dccp_options and _make_hip_param dropped b''. - Each raises ProtocolError in the shape TCP's does since #2708; the makers' Raises and each released class's 1.6.0 versionchanged say so. The six new modules fail on 01f0634 without the pcapkit/ change; the internet, transport, misc, root protocols and project modules pass.
Owner
Author
|
GOOD TO GO at
|
1 of 5 tasks
JarryShaw
added a commit
that referenced
this pull request
Nov 3, 2026
….6.0 (#2449) - Fixed: an empty raw option, parameter, cause, sub-option, attribute, CGA extension or PCAP-NG option or record shorter than its code raises ProtocolError (#2728), into the TCP and HIP makers' Fixed entry beside TCP's own; the IPv4, HOPOPT, IPv6-Opts, SCTP, MH, HIP and PCAP-NG outcomes measured against v1.5.1. - Folded into unreleased entries: DCCP's empty raw option (#2728). - No entry for the docstring-only 596dcfa and 6b63ee9, or the test-only 219fbbc. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
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.
make pylint,make mypy,make isort)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectAn empty raw item given to a maker's raw-bytes branch was mishandled. The outcome depended on the maker: a bare
IndexErrororAttributeError, an item silently dropped beside a whole one, or, in PCAP-NG, an end-of-options or end-of-records marker written in its place. Each now raisesProtocolError, in the message shape #2708 uses for TCP.A whole raw item still builds as given. The new tests fail on
main.Closes #2723