From 31f8576640e9e5f4b7d16bc87acd6fc2725700fe Mon Sep 17 00:00:00 2001 From: Scott Powell Date: Sat, 15 Mar 2025 22:06:57 +1100 Subject: [PATCH] * CMD_SIGN_DATA null check --- examples/companion_radio/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index f4c52b9b..3733470a 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -1282,7 +1282,7 @@ public: sign_data = (uint8_t *) malloc(MAX_SIGN_DATA_LEN); sign_data_len = 0; } else if (cmd_frame[0] == CMD_SIGN_DATA && len > 1) { - if (sign_data_len + (len - 1) > MAX_SIGN_DATA_LEN) { + if (sign_data == NULL || sign_data_len + (len - 1) > MAX_SIGN_DATA_LEN) { writeErrFrame(); // error: too long } else { memcpy(&sign_data[sign_data_len], &cmd_frame[1], len - 1);