This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 4cd4303c32 binfmt: Check return pointer. 4cd4303c32 is described below commit 4cd4303c321e20153b3b63d2c55d0c7e25e9dc22 Author: xiangdong6 <xiangdo...@xiaomi.com> AuthorDate: Sat Sep 3 13:10:23 2022 +0800 binfmt: Check return pointer. Function builtin_for_index may return NULL. We must check this to prevent visit invalid address. Signed-off-by: xiangdong6 <xiangdo...@xiaomi.com> --- binfmt/builtin.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/binfmt/builtin.c b/binfmt/builtin.c index a7a85d9a53..9ba1b59d8a 100644 --- a/binfmt/builtin.c +++ b/binfmt/builtin.c @@ -97,6 +97,12 @@ static int builtin_loadbinary(FAR struct binary_s *binp, */ builtin = builtin_for_index(index); + if (builtin == NULL) + { + berr("ERROR: %s is not a builtin application\n", filename); + return -ENOENT; + } + binp->entrypt = builtin->main; binp->stacksize = builtin->stacksize; binp->priority = builtin->priority;