From 3be9e1d197197bd6150bf9d18a4013500b1af046 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Mon, 25 Mar 2024 18:16:23 +0100 Subject: [PATCH] Changed how EIP-712 array progression is counted --- src_features/signMessageEIP712/path.c | 5 +++-- src_features/signMessageEIP712/path.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src_features/signMessageEIP712/path.c b/src_features/signMessageEIP712/path.c index 4381280..cf0f1e5 100644 --- a/src_features/signMessageEIP712/path.c +++ b/src_features/signMessageEIP712/path.c @@ -255,6 +255,7 @@ static bool array_depth_list_push(uint8_t path_idx, uint8_t size) { arr = &path_struct->array_depths[path_struct->array_depth_count]; arr->path_index = path_idx; arr->size = size; + arr->index = 0; path_struct->array_depth_count += 1; return true; } @@ -559,8 +560,8 @@ static bool path_advance_in_array(void) { if ((path_struct->array_depth_count > 0) && (arr_depth->path_index == (path_struct->depth_count - 1))) { - if (arr_depth->size > 0) arr_depth->size -= 1; - if (arr_depth->size == 0) { + arr_depth->index += 1; + if (arr_depth->index == arr_depth->size) { array_depth_list_pop(); end_reached = true; } else { diff --git a/src_features/signMessageEIP712/path.h b/src_features/signMessageEIP712/path.h index b7a31cb..2181561 100644 --- a/src_features/signMessageEIP712/path.h +++ b/src_features/signMessageEIP712/path.h @@ -12,6 +12,7 @@ typedef struct { uint8_t path_index; uint8_t size; + uint8_t index; } s_array_depth; typedef enum { ROOT_DOMAIN, ROOT_MESSAGE } e_root_type;