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 <35417409+Old-Ding@users.noreply.github.com>
This commit is contained in:
Old-Ding 2026-07-06 09:30:13 +08:00 committed by Xiang Xiao
parent c785d40af7
commit 64f9e8a4b7

View file

@ -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]);
}