Fix Shell log command argument parsing

This commit is contained in:
Simon Duquennoy 2017-07-10 16:32:41 +02:00
parent 5999323a05
commit f7d4d5a0ec

View File

@ -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);
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);