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 7bd8ba065213002e668759383628128fb76e979e
Author: Marco Casaroli <[email protected]>
AuthorDate: Wed Nov 11 14:53:28 2026 +0100

    netutils/thttpd: Give RENEW() the old size of the name arrays.
    
    With CONFIG_THTTPD_MEMDEBUG and CONFIG_THTTPD_GENERATE_INDICES,
    ls_child() gives RENEW() the old size of the directory name arrays in
    oldmax, which does not exist, so the build fails.  RENEW() gives the
    old size only to the memory debug statistics.
    
    Use the old value of maxnames, and double it after the two RENEW()
    calls.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 netutils/thttpd/libhttpd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/netutils/thttpd/libhttpd.c b/netutils/thttpd/libhttpd.c
index ecd2a90d0..f197b8acd 100644
--- a/netutils/thttpd/libhttpd.c
+++ b/netutils/thttpd/libhttpd.c
@@ -1687,10 +1687,10 @@ static void ls_child(int argc, char **argv)
             }
           else
             {
+              names     = RENEW(names, char, maxnames * PATH_MAX,
+                                2 * maxnames * PATH_MAX);
+              nameptrs  = RENEW(nameptrs, char *, maxnames, 2 * maxnames);
               maxnames *= 2;
-              names     = RENEW(names, char, oldmax * PATH_MAX,
-                                maxnames * PATH_MAX);
-              nameptrs  = RENEW(nameptrs, char *, oldmax, maxnames);
             }
 
           if (!names || !nameptrs)

Reply via email to