Skip to content

fix(sctp): a Host Name parameter without a NUL terminator parses but cannot be rebuilt #1482

Closed

Description

@JarryShaw

Describe the bug
An SCTP Host Name Address parameter (type 11) whose name has no NUL terminator parses, but cannot be rebuilt. The reader accepts the name as captured, while _make_param_hostname requires name.endswith(b'\x00'). This breaks the byte-exact round trip.

Reproduction

from pcapkit.protocols.transport.sctp import SCTP
b = bytes.fromhex('13881389deadbeef000000000100002000000001000003e8000a000a00000001000b000c6162636465666768')
p = SCTP(b); p.data == b      # True
SCTP.from_data(p.info)        # ProtocolError: SCTP: [Param 11] invalid format

The result is the same on main (f1e494884) and on #1481. With #1481, the unpadded form from #1479's repro (...000b0009 6162636465) fails the same way.

Expected behavior
from_data(info) and from_data(info.to_dict()) rebuild the captured octets exactly. Rejecting the name at parse would be the other consistent choice. Today parse and rebuild disagree.

System information
Linux, CPython 3.14.7, checkout at f1e494884.

Additional context
On f1e494884, the check is at pcapkit/protocols/transport/sctp.py:2967, in _make_param_hostname (:2945). _read_param_hostname is at :2696. Cutting a multi-chunk packet anywhere after its INIT chunk gives the same failure, as the #1481 review found. #1481's worker found this; it is out of #1481's scope, whose tests use abcd\0.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 9, 2026
  2. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 9, 2026
  3. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions