tagtree.c->loadroot() guard against overflow

forum user chris_s noted an possible unhandled cache overflow

Change-Id: Ia79399d6581ef6b635578896519fda8126c731d7
This commit is contained in:
William Wilgus 2018-12-22 12:45:02 -06:00
parent 5264a6eac1
commit 3e27705eb9

View file

@ -1627,6 +1627,9 @@ static int load_root(struct tree_context *c)
if (menu == NULL) if (menu == NULL)
return 0; return 0;
if (menu->itemcount > c->cache.max_entries)
panicf("%s tree_cache too small", __func__);
for (i = 0; i < menu->itemcount; i++) for (i = 0; i < menu->itemcount; i++)
{ {
dptr->name = menu->items[i]->name; dptr->name = menu->items[i]->name;