[PATCH v2] shell.c: Fix Dereference after null check (CID #26083)
Gedare Bloom
gedare at rtems.org
Mon Mar 15 19:58:55 UTC 2021
On Sun, Mar 14, 2021 at 8:27 PM Chris Johns <chrisj at rtems.org> wrote:
>
> Sorry, this patch is blocked by the v1 thread.
>
+1
And why I asked about the "use cases" for this shell login. I guess
those could be documented somewhere and some examples shown.
> Chris
>
> On 12/3/21 9:17 am, Ryan Long wrote:
> > CID 26083: Dereference after null check in rtems_shell_login().
> >
> > Closes #4327
> > ---
> > cpukit/libmisc/shell/shell.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
> > index 1e5962b..ad47460 100644
> > --- a/cpukit/libmisc/shell/shell.c
> > +++ b/cpukit/libmisc/shell/shell.c
> > @@ -789,6 +789,8 @@ static bool rtems_shell_login(rtems_shell_env_t *env, FILE * in,FILE * out)
> > }
> > }
> >
> > + _Assert(out != NULL);
> > +
> > return rtems_shell_login_prompt(in, out, env->devname, env->login_check);
> > }
> >
> > @@ -966,6 +968,9 @@ bool rtems_shell_main_loop(
> > "shell: cannot allocate prompt memory\n");
> > }
> >
> > + _Assert(stdin != NULL);
> > + _Assert(stdout != NULL);
> > +
> > shell_std_debug("child out: %d (%p)\n", fileno(stdout), stdout);
> > shell_std_debug("child in: %d (%p)\n", fileno(stdin), stdin);
> >
> >
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list