From a0777a0ee5a1d759c08960baafe0ba699516adef Mon Sep 17 00:00:00 2001 From: Xu Si Yu Date: Thu, 18 Sep 2025 16:21:13 +0800 Subject: [PATCH] fix(openthread): check if the command is valid before calling the input function --- components/openthread/src/esp_openthread_cli.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/openthread/src/esp_openthread_cli.c b/components/openthread/src/esp_openthread_cli.c index b7e1b933f9..f87e39f017 100644 --- a/components/openthread/src/esp_openthread_cli.c +++ b/components/openthread/src/esp_openthread_cli.c @@ -65,6 +65,7 @@ esp_err_t esp_openthread_cli_input(const char *line) static int ot_cli_console_callback(int argc, char **argv) { + ESP_RETURN_ON_FALSE(argv[1] != NULL && strlen(argv[1]) > 0, ESP_FAIL, OT_PLAT_LOG_TAG, "Invalid OpenThread command"); char cli_cmd[OT_CLI_MAX_LINE_LENGTH] = {0}; strncpy(cli_cmd, argv[1], sizeof(cli_cmd) - strlen(cli_cmd) - 1); for (int i = 2; i < argc; i++) {