mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
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:
parent
c785d40af7
commit
64f9e8a4b7
1 changed files with 1 additions and 1 deletions
|
|
@ -677,7 +677,7 @@ void init_dump_service(FAR struct service_s *s)
|
||||||
|
|
||||||
init_debug(" pid: %d", s->pid);
|
init_debug(" pid: %d", s->pid);
|
||||||
init_debug(" arguments:");
|
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]);
|
init_debug(" [%d] '%s'", i, s->argv[i]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue