From 628c1eae4cf79a2e1390d3bc0a368f4883c91b2d Mon Sep 17 00:00:00 2001 From: Andrey G Date: Sun, 13 Mar 2022 16:18:45 +0300 Subject: [PATCH] cli_registry: save 99 bytes (#3992) --- firmware/util/cli_registry.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/firmware/util/cli_registry.cpp b/firmware/util/cli_registry.cpp index afbc842d66..2eaebd2c25 100644 --- a/firmware/util/cli_registry.cpp +++ b/firmware/util/cli_registry.cpp @@ -24,6 +24,8 @@ /* for isspace() */ #include +#define MAX_CMD_LINE_LENGTH 100 + // todo: support \t as well #define SPACE_CHAR ' ' @@ -500,7 +502,7 @@ char *validateSecureLine(char *line) { return line; } -static char handleBuffer[200]; +static char handleBuffer[MAX_CMD_LINE_LENGTH + 1]; static int handleConsoleLineInternal(const char *commandLine, int lineLength) { int len = minI(lineLength, sizeof(handleBuffer) - 1); @@ -543,8 +545,7 @@ void handleConsoleLine(char *line) { return; // error detected int lineLength = strlen(line); - if (lineLength > 100) { - // todo: better max size logic + if (lineLength > MAX_CMD_LINE_LENGTH) { // todo: better reaction to excessive line efiPrintf("Long line?"); return;