[FL-3672] CLI: cat command crash workaround (#3358)

* Cli input len limit, CDC EP type fix

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Nikolay Minaylov
2024-02-09 11:59:24 +03:00
committed by GitHub
parent c0db3d541e
commit b2a7bb0696
2 changed files with 38 additions and 21 deletions

View File

@@ -6,6 +6,8 @@
#define TAG "CliSrv"
#define CLI_INPUT_LEN_LIMIT 256
Cli* cli_alloc() {
Cli* cli = malloc(sizeof(Cli));
@@ -356,7 +358,9 @@ void cli_process_input(Cli* cli) {
cli_handle_backspace(cli);
} else if(in_chr == CliSymbolAsciiCR) {
cli_handle_enter(cli);
} else if(in_chr >= 0x20 && in_chr < 0x7F) { //-V560
} else if(
(in_chr >= 0x20 && in_chr < 0x7F) && //-V560
(furi_string_size(cli->line) < CLI_INPUT_LEN_LIMIT)) {
if(cli->cursor_position == furi_string_size(cli->line)) {
furi_string_push_back(cli->line, in_chr);
cli_putc(cli, in_chr);