summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell/shell_cmdset.c
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2021-08-21 12:49:36 +1000
committerChris Johns <chrisj@rtems.org>2021-08-21 12:49:36 +1000
commit8f3973fe8d40a781727250b733b76d97bc091fe1 (patch)
treeb656bb2fb3a0331524ac965f9b81fd2d96e293f7 /cpukit/libmisc/shell/shell_cmdset.c
parentlibmisc/fdt: fix node initialise error with RTEMS_DEBUG (diff)
downloadrtems-8f3973fe8d40a781727250b733b76d97bc091fe1.tar.bz2
libmisc/shell: Check the shell command pointers when adding a command
Diffstat (limited to '')
-rw-r--r--cpukit/libmisc/shell/shell_cmdset.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cpukit/libmisc/shell/shell_cmdset.c b/cpukit/libmisc/shell/shell_cmdset.c
index be64b83fe4..95f180bbb5 100644
--- a/cpukit/libmisc/shell/shell_cmdset.c
+++ b/cpukit/libmisc/shell/shell_cmdset.c
@@ -112,6 +112,11 @@ rtems_shell_cmd_t *rtems_shell_add_cmd_struct(
rtems_shell_cmd_t **next_ptr = &rtems_shell_first_cmd;
rtems_shell_cmd_t *existing;
+ if (shell_cmd == NULL)
+ return NULL;
+ if (shell_cmd->name == NULL)
+ return NULL;
+
/*
* Iterate through all commands and check if a command with this name is
* already present.