1
0
Fork 0
forked from nuttx/nuttx-update

binfmt: Handle argv/argv[0] == NULL correctly in exec_module

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-06-16 01:38:07 +08:00 committed by patacongo
parent 2e49e1bc5c
commit 34f31ff3f8

View file

@ -168,8 +168,17 @@ int exec_module(FAR const struct binary_s *binp,
/* Initialize the task */
ret = nxtask_init(tcb, argv[0], binp->priority, NULL,
binp->stacksize, binp->entrypt, &argv[1]);
if (argv && argv[0])
{
ret = nxtask_init(tcb, argv[0], binp->priority, NULL,
binp->stacksize, binp->entrypt, &argv[1]);
}
else
{
ret = nxtask_init(tcb, filename, binp->priority, NULL,
binp->stacksize, binp->entrypt, argv);
}
binfmt_freeargv(argv);
if (ret < 0)
{