shell: Fix case when too many arguments are provided

Shell was accepting CONFIG_SHELL_ARGC_MAX+1 arguments which lead to
memory corruption and fault. Added error message reported when number
of provided arguments exceeds CONFIG_SHELL_ARGC_MAX.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2020-09-11 09:54:12 +02:00 committed by Carles Cufí
commit 770f232a67
3 changed files with 15 additions and 8 deletions

View file

@ -194,8 +194,6 @@ char shell_make_argv(size_t *argc, const char **argv, char *cmd, uint8_t max_arg
quote = make_argv(&cmd, c);
} while (true);
argv[*argc] = 0;
return quote;
}