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 7af8ed81fd7482ffcc47223e8c4c12836e9adc48
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Wed May 27 09:26:30 2026 -0300

    system/nxinit: Fix name[0] issue
    
    This an issue where a variable was declared as name[0]
    
    Signed-off-by: Alan C. Assis <[email protected]>
---
 system/nxinit/service.c | 1 +
 system/nxinit/service.h | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/system/nxinit/service.c b/system/nxinit/service.c
index 0d39bb614..3f7578fea 100644
--- a/system/nxinit/service.c
+++ b/system/nxinit/service.c
@@ -224,6 +224,7 @@ static int option_class(FAR struct service_manager_s *sm,
       return -errno;
     }
 
+  len = (len >= MAX_NXINIT_SERVICE_NAME) ? MAX_NXINIT_SERVICE_NAME : len;
   memcpy(c->name, argv[1], len);
   list_add_tail(&s->classes, &c->node);
   return 0;
diff --git a/system/nxinit/service.h b/system/nxinit/service.h
index d76406e56..babf6edd2 100644
--- a/system/nxinit/service.h
+++ b/system/nxinit/service.h
@@ -66,6 +66,8 @@
 
 #define SVC_REMOVE      (1 << 31)
 
+#define MAX_NXINIT_SERVICE_NAME 32
+
 /****************************************************************************
  * Public Types
  ****************************************************************************/
@@ -73,7 +75,7 @@
 struct service_class_s
 {
   struct list_node node;     /* Service class list node */
-  FAR char name[0];
+  FAR char name[MAX_NXINIT_SERVICE_NAME];
 };
 
 struct service_s

Reply via email to