Skip to content

testing: nettest: Fix TCP server terminator bounds#3599

Open
Old-Ding wants to merge 1 commit into
apache:masterfrom
Old-Ding:codex/nettest-tcpserver-terminator
Open

testing: nettest: Fix TCP server terminator bounds#3599
Old-Ding wants to merge 1 commit into
apache:masterfrom
Old-Ding:codex/nettest-tcpserver-terminator

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

The TCP nettest server receives up to TEST_BUFFER_SIZE bytes and then appends a NUL terminator before checking for the exit command. A full-size receive can therefore write one byte past the receive buffer.

Reserve one extra byte for the terminator while keeping the recv() limit and echo length capped at TEST_BUFFER_SIZE.

Validation

  • git diff --check origin/master..HEAD
  • git show --check --stat --oneline HEAD
  • git ls-files --eol testing/nettest/utils/nettest_tcpserver.c

The TCP nettest server receives up to TEST_BUFFER_SIZE bytes and then appends a NUL terminator before checking for the exit command. A full-size receive can therefore write one byte past the receive buffer.

Reserve one extra byte for the terminator while keeping the recv() limit and echo length capped at TEST_BUFFER_SIZE.

Signed-off-by: Old-Ding <35417409+Old-Ding@users.noreply.github.com>

@cederom cederom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Old-Ding, looks good, please just updaye git commit signature to valid email :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants