mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 18:10:57 +02:00
fix(openthread): check if the command is valid before calling the input function
This commit is contained in:
@@ -65,6 +65,7 @@ esp_err_t esp_openthread_cli_input(const char *line)
|
|||||||
|
|
||||||
static int ot_cli_console_callback(int argc, char **argv)
|
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};
|
char cli_cmd[OT_CLI_MAX_LINE_LENGTH] = {0};
|
||||||
strncpy(cli_cmd, argv[1], sizeof(cli_cmd) - strlen(cli_cmd) - 1);
|
strncpy(cli_cmd, argv[1], sizeof(cli_cmd) - strlen(cli_cmd) - 1);
|
||||||
for (int i = 2; i < argc; i++) {
|
for (int i = 2; i < argc; i++) {
|
||||||
|
Reference in New Issue
Block a user