Skip to content

Commit 4c50b07

Browse files
[Audit] Fix EIP712 part
1 parent d95d245 commit 4c50b07

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src_features/signMessageEIP712/ui_logic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,8 @@ void ui_712_set_trusted_name_requirements(uint8_t type_count,
12271227
*
12281228
*/
12291229
void ui_712_push_pairs(void) {
1230-
uint16_t nbPairs = 0;
1231-
uint16_t pair = 0;
1230+
uint8_t nbPairs = 0;
1231+
uint8_t pair = 0;
12321232
s_ui_712_pair *tmp = NULL;
12331233

12341234
// Initialize the pairs list

src_features/signMessageEIP712_common/common_712.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ static char *format_hash(const uint8_t *hash, char *buffer, size_t buffer_size,
6767
}
6868

6969
void eip712_format_hash(uint8_t index) {
70+
if ((g_pairs == NULL) || (g_pairsList == NULL) || (index >= g_pairsList->nbPairs)) {
71+
return;
72+
}
7073
g_pairs[index].item = "Domain hash";
7174
g_pairs[index].value = format_hash(tmpCtx.messageSigningContext712.domainHash,
7275
strings.tmp.tmp,

src_nbgl/ui_sign_712.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ static void ui_712_start_review(nbgl_operationType_t operationType,
2828
// Initialize the finish title string
2929
finish_len += strlen(tx_check_str);
3030
finish_len += strlen(title_suffix);
31-
ui_buffers_init(0, 0, finish_len);
31+
if (!ui_buffers_init(0, 0, finish_len)) {
32+
return;
33+
}
3234
snprintf(g_finishMsg, finish_len, "%s%s", tx_check_str, title_suffix);
3335
#ifdef HAVE_TRANSACTION_CHECKS
3436
set_tx_simulation_warning();

0 commit comments

Comments
 (0)