From 31cdcdd0a4b77e9960979e4e9b271e7291cbfdc5 Mon Sep 17 00:00:00 2001 From: Francois Berder <18538310+francois-berder@users.noreply.github.com> Date: Sat, 2 May 2020 20:55:28 +0100 Subject: [PATCH] sys/shell: commands: Check argc in _pm_handler Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com> --- sys/shell/commands/sc_pm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/shell/commands/sc_pm.c b/sys/shell/commands/sc_pm.c index fe5dec21c..44e3c915b 100644 --- a/sys/shell/commands/sc_pm.c +++ b/sys/shell/commands/sc_pm.c @@ -149,6 +149,11 @@ static int cmd_off(char *arg) int _pm_handler(int argc, char **argv) { + if (argc < 2) { + _print_usage(); + return 1; + } + #ifdef MODULE_PM_LAYERED if (!strcmp(argv[1], "show")) { if (argc != 2) { @@ -182,8 +187,6 @@ int _pm_handler(int argc, char **argv) return cmd_set(argv[2]); } -#else - (void)argc; #endif /* MODULE_PM_LAYERED */ if (!strcmp(argv[1], "off")) {