Skip to content

fix(pcap,pcapng): building a packet longer than the snaplen clips the declared length but writes every octet #1283

Closed

Description

@JarryShaw

Describe the bug
incl_len/captured_len is min(len, snaplen) (pcapkit/protocols/misc/pcap/frame.py:362, pcapkit/protocols/misc/pcapng.py:3768, plus the SPB and PB makers), but the payload is not clipped.

To Reproduce

Frame(num=1, header=Header(snaplen=8).info, packet=b'A'*16)
# incl_len=8, orig_len=16, 16 octets follow (record is 32 octets, want 24)

EPB, PB and SPB built with snaplen 8 also write 16 data octets.

Expected behavior
The payload is clipped to the declared captured length.

Found by the misc round-trip audit (#1202). The repro was re-checked by an independent verifier, and I re-ran it on main at 11ae68ebf.

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 7, 2026
  2. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until the PCAP-NG K1-K5 PR (#1267-#1271) merges.

  3. added
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  4. JarryShaw commented on Oct 7, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1339 merged at 20:42Z. Back to pending.

  5. added
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 7, 2026
  6. moved this from Blocked to WIP in PyPCAPKiton Oct 7, 2026
  7. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 8, 2026
  8. added this to the PyPCAPKit v1.5 milestone on Oct 25, 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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions