[rtems commit] libmisc/shell: Check the shell command pointers when adding a command

Chris Johns chrisj at rtems.org
Sat Aug 21 02:49:52 UTC 2021


Module:    rtems
Branch:    master
Commit:    8f3973fe8d40a781727250b733b76d97bc091fe1
Changeset: http://git.rtems.org/rtems/commit/?id=8f3973fe8d40a781727250b733b76d97bc091fe1

Author:    Chris Johns <chrisj at rtems.org>
Date:      Sat Aug 21 12:49:36 2021 +1000

libmisc/shell: Check the shell command pointers when adding a command

---

 cpukit/libmisc/shell/shell_cmdset.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cpukit/libmisc/shell/shell_cmdset.c b/cpukit/libmisc/shell/shell_cmdset.c
index be64b83..95f180b 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.



More information about the vc mailing list