From 6983d8cbb859543976ccc7029f3336851c037599 Mon Sep 17 00:00:00 2001 From: Charles-Edouard de la Vergne Date: Wed, 13 Mar 2024 11:48:12 +0100 Subject: [PATCH] Fix screen message buffer overwrite --- src/gpg_ux_nanos.c | 2 +- src/gpg_ux_nanox.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gpg_ux_nanos.c b/src/gpg_ux_nanos.c index 9dbdc7f..a2b9230 100644 --- a/src/gpg_ux_nanos.c +++ b/src/gpg_ux_nanos.c @@ -425,7 +425,7 @@ static void validate_pin() { sizeof(G_gpg_vstate.menu), " %d tries remaining", pin->counter); - ui_info(WRONG_PIN, EMPTY, ui_menu_main_display, 0); + ui_info(WRONG_PIN, G_gpg_vstate.menu, ui_menu_main_display, 0); return; } offset = 1 + G_gpg_vstate.work.io_buffer[0]; diff --git a/src/gpg_ux_nanox.c b/src/gpg_ux_nanox.c index efdaf45..efa42fd 100644 --- a/src/gpg_ux_nanox.c +++ b/src/gpg_ux_nanox.c @@ -329,11 +329,11 @@ static void validate_pin() { gpg_io_insert_u16(sw); gpg_io_do(IO_RETURN_AFTER_TX); if (sw != SW_OK) { - snprintf(G_gpg_vstate.menu, - sizeof(G_gpg_vstate.menu), + snprintf(G_gpg_vstate.ux_buff1, + sizeof(G_gpg_vstate.ux_buff1), " %d tries remaining", pin->counter); - ui_info(WRONG_PIN, G_gpg_vstate.menu); + ui_info(WRONG_PIN, G_gpg_vstate.ux_buff1); } else { ui_menu_main_display(0); } @@ -354,11 +354,11 @@ static void validate_pin() { gpg_io_discard(1); gpg_io_insert_u16(SW_CONDITIONS_NOT_SATISFIED); gpg_io_do(IO_RETURN_AFTER_TX); - snprintf(G_gpg_vstate.menu, - sizeof(G_gpg_vstate.menu), + snprintf(G_gpg_vstate.ux_buff1, + sizeof(G_gpg_vstate.ux_buff1), " %d tries remaining", pin->counter); - ui_info(WRONG_PIN, EMPTY); + ui_info(WRONG_PIN, G_gpg_vstate.ux_buff1); return; } offset = 1 + G_gpg_vstate.work.io_buffer[0];