Fix string handling in the pcapng library and improve test coverage.

The pcapng format uses 16-bit length fields for option data, but the
library did not validate input lengths and used fixed-size stack
buffers that could overflow with large strings.

Patches 1-4 add string validation, dynamic allocation, and return
value documentation. Existing return value conventions are preserved
to avoid an ABI break.

Patch 5 chains an additional mbuf segment when a comment exceeds
tailroom instead of dropping the packet.

Patch 6 replaces per-packet timestamp divisions with a precomputed
reciprocal multiply-shift.

Patches 7-8 improve test coverage and fix the build dependency on
the null PMD.

v8:
  - Split patches for clarity (typo, Doxygen, validation, malloc)
  - Preserve existing API/ABI — no error return changes
  - Drop dumpcap patch (no API change to handle)
  - Truncate overlong comments via strnlen on fast path
  - Defer port_index update until after successful write

v7:
  - Add meson build fix for disabled null PMD
  - Add dumpcap error reporting improvements


Stephen Hemminger (8):
  pcapng: correct typo in comment
  pcapng: document return values
  pcapng: add length checks to string arguments
  pcapng: use malloc instead of fixed buffer size
  pcapng: chain additional mbuf when comment exceeds tailroom
  pcapng: improve performance of timestamping
  test/pcapng: skip test if null driver missing
  test/pcapng: add tests for comments

 app/test/meson.build                   |   2 +-
 app/test/test_pcapng.c                 | 154 +++++++++++++-----
 doc/guides/rel_notes/release_26_03.rst |   5 +
 lib/pcapng/rte_pcapng.c                | 207 +++++++++++++++++++------
 lib/pcapng/rte_pcapng.h                |  13 +-
 5 files changed, 288 insertions(+), 93 deletions(-)

-- 
2.51.0

Reply via email to