From c704a4b7abefe627553f55fd98ececa869ceb8f1 Mon Sep 17 00:00:00 2001 From: Marek Bel Date: Wed, 6 Feb 2019 18:25:45 +0100 Subject: [PATCH] Fix menu stack overrun. --- Firmware/menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 89fadb66..b7ae1d5e 100644 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -120,7 +120,7 @@ void menu_back_if_clicked_fb(void) void menu_submenu(menu_func_t submenu) { - if (menu_depth <= MENU_DEPTH_MAX) + if (menu_depth < MENU_DEPTH_MAX) { menu_stack[menu_depth].menu = menu_menu; menu_stack[menu_depth++].position = lcd_encoder; @@ -130,7 +130,7 @@ void menu_submenu(menu_func_t submenu) static void menu_submenu_no_reset(menu_func_t submenu) { - if (menu_depth <= MENU_DEPTH_MAX) + if (menu_depth < MENU_DEPTH_MAX) { menu_stack[menu_depth].menu = menu_menu; menu_stack[menu_depth++].position = lcd_encoder;