mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-22 12:32:02 +00:00
Merge pull request #41 from romanz/fsm_assert
fsm: add compile-time assert for response size validation
This commit is contained in:
commit
e9e51b1377
@ -51,7 +51,9 @@
|
|||||||
|
|
||||||
static uint8_t msg_resp[MSG_OUT_SIZE];
|
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)
|
void fsm_sendSuccess(const char *text)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user