Fix uninitialized UI buffer for EIP-712

Would refuse the message altogether if strings.tmp.tmp wasn't empty.
Introduced in 4680a9d583
This commit is contained in:
Alexandre Paillier
2024-07-26 14:18:14 +02:00
parent 44b5a23785
commit 617291db6d

View File

@@ -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;
}