mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
fsm: add compile-time assert for response size validation
ttps://gcc.gnu.org/gcc-4.6/changes.html
This commit is contained in:
parent
8b1f8a4595
commit
1bb00adc37
@ -51,7 +51,9 @@
|
||||
|
||||
static uint8_t msg_resp[MSG_OUT_SIZE];
|
||||
|
||||
#define RESP_INIT(TYPE) TYPE *resp = (TYPE *)msg_resp; memset(resp, 0, sizeof(TYPE));
|
||||
#define RESP_INIT(TYPE) TYPE *resp = (TYPE *)msg_resp; \
|
||||
_Static_assert(sizeof(msg_resp) >= sizeof(TYPE), #TYPE " is too large"); \
|
||||
memset(resp, 0, sizeof(TYPE));
|
||||
|
||||
void fsm_sendSuccess(const char *text)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user