Skip to content

Commit c23a3dd

Browse files
author
Cerberus Merlin
committed
fix: 8-bit pair counters overflow in generic clear-signing UI builder src/nbgl/ui_gcs.c
1 parent bae8f45 commit c23a3dd

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/nbgl/ui_gcs.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ bool ui_gcs(void) {
398398
bool show_network;
399399
nbgl_contentValueExt_t *ext = NULL;
400400
nbgl_contentInfoList_t *infolist = NULL;
401-
uint8_t nbPairs = 0;
402-
uint8_t pair = 0;
401+
size_t nbPairs = 0;
402+
size_t pair = 0;
403403
uint8_t tx_idx = 0;
404404
const s_tx_info *info_tx = get_current_tx_info();
405405

@@ -440,7 +440,12 @@ bool ui_gcs(void) {
440440
// Fees
441441
nbPairs += 1;
442442

443-
if (!ui_pairs_init(nbPairs)) {
443+
if (nbPairs > UINT8_MAX) {
444+
PRINTF("Error: Too many review fields: %u\n", (unsigned) nbPairs);
445+
return false;
446+
}
447+
448+
if (!ui_pairs_init((uint8_t) nbPairs)) {
444449
return false;
445450
}
446451

0 commit comments

Comments
 (0)