* CMD_SIGN_DATA null check

This commit is contained in:
Scott Powell 2025-03-15 22:06:57 +11:00
parent 6056c303c1
commit 31f8576640

View file

@ -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);