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 64f9e8a4b system: nxinit: bound debug argv dump
64f9e8a4b is described below
commit 64f9e8a4b76880cba545ab2e55447c38c690899b
Author: Old-Ding <[email protected]>
AuthorDate: Mon Jul 6 09:30:13 2026 +0800
system: nxinit: bound debug argv dump
Check the service argv array bound before reading the current entry in the
debug dump loop. A full argument array may not have an in-array NULL
terminator, so the old condition could read one entry past the array while
CONFIG_SYSTEM_NXINIT_DEBUG is enabled.
Signed-off-by: Old-Ding <[email protected]>
---
system/nxinit/service.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system/nxinit/service.c b/system/nxinit/service.c
index 7e840e7e7..8a92bb20b 100644
--- a/system/nxinit/service.c
+++ b/system/nxinit/service.c
@@ -677,7 +677,7 @@ void init_dump_service(FAR struct service_s *s)
init_debug(" pid: %d", s->pid);
init_debug(" arguments:");
- for (i = 0; s->argv[i] && i < nitems(s->argv); i++)
+ for (i = 0; i < nitems(s->argv) && s->argv[i]; i++)
{
init_debug(" [%d] '%s'", i, s->argv[i]);
}