testing: nettest: Fix TCP server terminator bounds

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 <ai.neo.ae86@gmail.com>
This commit is contained in:
Old-Ding 2026-07-06 04:32:20 +08:00 committed by Xiang Xiao
parent 50ffee7a85
commit 662133eeca

View file

@ -47,7 +47,7 @@ struct nettest_listener_s
{
fd_set master;
fd_set working;
char buffer[TEST_BUFFER_SIZE];
char buffer[TEST_BUFFER_SIZE + 1];
int listensdv4;
int listensdv6;
int mxsd;