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

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

commit 96946de67f43aac79f938d41e387dcfe6f8b8f40
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Nov 2 13:31:20 2026 +0100

    netutils/thttpd: End the argument list of the indexing task.
    
    ls() gave task_create() an argv array with one entry and no NULL at
    the end, so task_create() read past the array to count and copy the
    arguments.  On qemu-armv8a the server task crashed with a data abort at
    the first request for a directory index.  Add the NULL, as cgi() does.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 netutils/thttpd/libhttpd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/netutils/thttpd/libhttpd.c b/netutils/thttpd/libhttpd.c
index 4292fda04..138b36998 100644
--- a/netutils/thttpd/libhttpd.c
+++ b/netutils/thttpd/libhttpd.c
@@ -1874,7 +1874,7 @@ static int ls(httpd_conn *hc)
   DIR *dirp;
   int child;
   char arg[16];
-  char *argv[1];
+  char *argv[2];
 #if CONFIG_THTTPD_CGI_TIMELIMIT > 0
   clientdata client_data;
 #endif
@@ -1911,6 +1911,7 @@ static int ls(httpd_conn *hc)
 
       snprintf(arg, 16, "%p", hc); /* task_create doesn't handle binary 
arguments. */
       argv[0] = arg;
+      argv[1] = NULL;
 
       child = task_create("CGI child", CONFIG_THTTPD_CGI_PRIORITY,
                           CONFIG_THTTPD_CGI_STACKSIZE, (main_t)ls_child,

Reply via email to