diff --git a/quantum/via.c b/quantum/via.c index 253cecae67..ee102d180c 100644 --- a/quantum/via.c +++ b/quantum/via.c @@ -357,13 +357,15 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { case id_dynamic_keymap_macro_get_buffer: { uint16_t offset = (command_data[0] << 8) | command_data[1]; uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_macro_get_buffer(offset, size, &command_data[3]); + if (size <= 28) + dynamic_keymap_macro_get_buffer(offset, size, &command_data[3]); break; } case id_dynamic_keymap_macro_set_buffer: { uint16_t offset = (command_data[0] << 8) | command_data[1]; uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_macro_set_buffer(offset, size, &command_data[3]); + if (size <= 28) + dynamic_keymap_macro_set_buffer(offset, size, &command_data[3]); break; } case id_dynamic_keymap_macro_reset: { @@ -377,13 +379,15 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { case id_dynamic_keymap_get_buffer: { uint16_t offset = (command_data[0] << 8) | command_data[1]; uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_get_buffer(offset, size, &command_data[3]); + if (size <= 28) + dynamic_keymap_get_buffer(offset, size, &command_data[3]); break; } case id_dynamic_keymap_set_buffer: { uint16_t offset = (command_data[0] << 8) | command_data[1]; uint16_t size = command_data[2]; // size <= 28 - dynamic_keymap_set_buffer(offset, size, &command_data[3]); + if (size <= 28) + dynamic_keymap_set_buffer(offset, size, &command_data[3]); break; } case id_eeprom_reset: {