shell: fix select command
If the command buffer is empty the shell was trying to read a string from a random memory location. Added a condition checking "argc" value when the select command is executed. Fixes: #27227 Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordisemi.no>
This commit is contained in:
parent
e90873f290
commit
e76cd05e18
1 changed files with 2 additions and 2 deletions
|
@ -236,7 +236,7 @@ static bool tab_prepare(const struct shell *shell,
|
|||
(void)shell_make_argv(argc, *argv, shell->ctx->temp_buff,
|
||||
CONFIG_SHELL_ARGC_MAX);
|
||||
|
||||
if (IS_ENABLED(CONFIG_SHELL_CMDS_SELECT) &&
|
||||
if (IS_ENABLED(CONFIG_SHELL_CMDS_SELECT) && (*argc > 0) &&
|
||||
(strcmp("select", (*argv)[0]) == 0) &&
|
||||
!shell_in_select_mode(shell)) {
|
||||
*argv = *argv + 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue