From a6b64a1d8c6cdadece333edfcb0589d0711b5a58 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 23 May 2024 02:42:58 -0400 Subject: init: mshell: Handle empty commands Signed-off-by: Ian Moffett --- usr.sbin/init/mshell.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/init/mshell.c b/usr.sbin/init/mshell.c index 78c3a82..dde07a9 100644 --- a/usr.sbin/init/mshell.c +++ b/usr.sbin/init/mshell.c @@ -77,6 +77,10 @@ parse_input(struct mshell_state *state) cmd[cmd_idx] = '\0'; + /* Ignore empty commands */ + if (cmd_idx == 0) + return; + if (strcmp(cmd, "reboot") == 0) { reboot(REBOOT_DEFAULT); } else if (strcmp(cmd, "pagesize") == 0) { -- cgit v1.2.3