[PATCH v2] shell.c: Fix Dereference after null check (CID #26083)
Chris Johns
chrisj at rtems.org
Mon Mar 15 00:27:36 UTC 2021
Sorry, this patch is blocked by the v1 thread.
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);
>
>
More information about the devel
mailing list