From f7d4d5a0ecd5e64db72057e15048509ddeff4994 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Mon, 10 Jul 2017 16:32:41 +0200 Subject: [PATCH] Fix Shell log command argument parsing --- apps/shell/shell-commands.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/shell/shell-commands.c b/apps/shell/shell-commands.c index bfbd94e32..33ce46163 100644 --- a/apps/shell/shell-commands.c +++ b/apps/shell/shell-commands.c @@ -192,7 +192,11 @@ PT_THREAD(cmd_log(struct pt *pt, shell_output_func output, char *args)) /* Get and parse argument */ SHELL_ARGS_NEXT(args, next_args); - level = (int)strtol(args, &ptr, 10); + if(args == NULL) { + level = -1; + } else { + level = (int)strtol(args, &ptr, 10); + } if((level == 0 && args == ptr) || level < LOG_LEVEL_NONE || level > LOG_LEVEL_DBG) { SHELL_OUTPUT(output, "Invalid argument: %s\n", args);