[PATCH v2] shell.c: Fix Dereference after null check (CID #26083)

Gedare Bloom gedare at rtems.org
Thu Mar 11 22:51:38 UTC 2021


OK

On Thu, Mar 11, 2021 at 3:17 PM Ryan Long <ryan.long at oarcorp.com> 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);
>
> --
> 1.8.3.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list