From 617291db6de2d49f0e35f74d5926e86a7a1962dd Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Fri, 26 Jul 2024 14:18:14 +0200 Subject: [PATCH] Fix uninitialized UI buffer for EIP-712 Would refuse the message altogether if strings.tmp.tmp wasn't empty. Introduced in 4680a9d583393a50b49efa4992f31b2c117ad803 --- src_features/signMessageEIP712/ui_logic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src_features/signMessageEIP712/ui_logic.c b/src_features/signMessageEIP712/ui_logic.c index 357cca5..5d698b1 100644 --- a/src_features/signMessageEIP712/ui_logic.c +++ b/src_features/signMessageEIP712/ui_logic.c @@ -177,8 +177,7 @@ e_eip712_nfs ui_712_next_field(void) { handle_eip712_return_code(true); state = EIP712_FIELD_INCOMING; // So that later when we append to them, we start from an empty string - explicit_bzero(strings.tmp.tmp, sizeof(strings.tmp.tmp)); - explicit_bzero(strings.tmp.tmp2, sizeof(strings.tmp.tmp2)); + explicit_bzero(&strings, sizeof(strings)); } } return state; @@ -622,6 +621,7 @@ bool ui_712_init(void) { if ((ui_ctx = MEM_ALLOC_AND_ALIGN_TYPE(*ui_ctx))) { explicit_bzero(ui_ctx, sizeof(*ui_ctx)); ui_ctx->filtering_mode = EIP712_FILTERING_BASIC; + explicit_bzero(&strings, sizeof(strings)); } else { apdu_response_code = APDU_RESPONSE_INSUFFICIENT_MEMORY; }