1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +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:
Roman Zeyde 2015-08-24 13:47:27 +03:00
parent 8b1f8a4595
commit 1bb00adc37

View File

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