summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell
diff options
context:
space:
mode:
authorRyan Long <thisisryanlong@gmail.com>2021-02-18 09:35:13 -0500
committerJoel Sherrill <joel@rtems.org>2021-02-18 13:34:33 -0600
commitfa25b73ac191fd9e4664da3197aef874488cee0e (patch)
treed4094b549613ba5463fc51a583b622f174f28aa9 /cpukit/libmisc/shell
parentrtems: Generate <rtems/rtems/sem.h> (diff)
downloadrtems-fa25b73ac191fd9e4664da3197aef874488cee0e.tar.bz2
shell.c: Fix Dereference before null check (CID #1467420)
CID 1467420: Dereference before null check in rtems_shell_line_editor(). Closes #4254
Diffstat (limited to 'cpukit/libmisc/shell')
-rw-r--r--cpukit/libmisc/shell/shell.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 3c357a1ca9..1e5962b1e3 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