summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-04-07 12:15:20 -0400
committerSolomon Peachy <pizza@shaftnet.org>2021-04-07 16:22:09 +0000
commitc5cf15ed02aefe4f2654ae6a0b7794733125b8d2 (patch)
tree68ae98baad3977e3035f37b0734423b65b803742
parentda542020c466ed57511e3fe5977bee93ed1d48aa (diff)
downloadrockbox-c5cf15ed02.tar.gz
rockbox-c5cf15ed02.zip
menu.c submenu items should be limited to MAX_MENU_SUBITEMS
maybe someone is checking somewhere but pretty sure the error message is a buffer overflow Change-Id: I3b95db12bbbd4631223bbbbe540beb2d0dd984c6
-rw-r--r--apps/menu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/menu.c b/apps/menu.c
index a7d52896a6..b25aa46a2c 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -180,7 +180,8 @@ static void init_menu_lists(const struct menu_item_ex *menu,
struct gui_synclist *lists, int selected, bool callback,
struct viewport parent[NB_SCREENS])
{
- int i, count = MENU_GET_COUNT(menu->flags);
+ int i;
+ int count = MIN(MENU_GET_COUNT(menu->flags), MAX_MENU_SUBITEMS);
int type = (menu->flags&MENU_TYPE_MASK);
menu_callback_type menu_callback = NULL;
int icon;
@@ -210,6 +211,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
current_subitems_count++;
}
}
+
current_submenus_menu = (struct menu_item_ex *)menu;
gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1, parent);