This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 662133eec testing: nettest: Fix TCP server terminator bounds
662133eec is described below

commit 662133eeca511f00d4051d79070192e8bb4f7a3c
Author: Old-Ding <[email protected]>
AuthorDate: Mon Jul 6 04:32:20 2026 +0800

    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 <[email protected]>
---
 testing/nettest/utils/nettest_tcpserver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testing/nettest/utils/nettest_tcpserver.c 
b/testing/nettest/utils/nettest_tcpserver.c
index a11f41d92..85c4a458a 100644
--- a/testing/nettest/utils/nettest_tcpserver.c
+++ b/testing/nettest/utils/nettest_tcpserver.c
@@ -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;

Reply via email to