[PATCH 5/5] shell.c: Fix Dereference before null check (CID #1467420)
Gedare Bloom
gedare at rtems.org
Thu Feb 18 18:09:24 UTC 2021
This one can get pushed.
On Thu, Feb 18, 2021 at 7:35 AM Ryan Long <thisisryanlong at gmail.com> wrote:
>
> CID 1467420: Dereference before null check in rtems_shell_line_editor().
>
> Closes #4254
> ---
> cpukit/libmisc/shell/shell.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
> index 3c357a1..1e5962b 100644
> --- a/cpukit/libmisc/shell/shell.c
> +++ b/cpukit/libmisc/shell/shell.c
> @@ -320,7 +320,10 @@ static int rtems_shell_line_editor(
> int cmd = -1;
> int inserting = 1;
> int in_fileno = fileno(in);
> - int out_fileno = fileno(out);
> + int out_fileno;
> +
> + _Assert(out != NULL);
> + out_fileno = fileno(out);
>
> /*
> * Only this task can use this file descriptor because calling
> --
> 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