1
0
Fork 0
forked from len0rd/rockbox

Increased maximum number of menus to 16 and avoiding a crash.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11019 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2006-09-21 17:16:35 +00:00
parent 2692c4e278
commit 1dc35774bf
2 changed files with 19 additions and 3 deletions

View file

@ -107,9 +107,6 @@ struct menu_entry {
int link; int link;
}; };
#define TAGNAVI_VERSION "#! rockbox/tagbrowser/2.0"
#define TAGMENU_MAX_ITEMS 32
#define TAGMENU_MAX_MENUS 8
struct root_menu { struct root_menu {
char title[64]; char title[64];
char id[32]; char id[32];
@ -596,7 +593,10 @@ static bool parse_menu(const char *filename)
int i; int i;
if (menu_count >= TAGMENU_MAX_MENUS) if (menu_count >= TAGMENU_MAX_MENUS)
{
logf("max menucount reached");
return false; return false;
}
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if (fd < 0) if (fd < 0)
@ -659,6 +659,12 @@ static bool parse_menu(const char *filename)
break; break;
case var_menu_start: case var_menu_start:
if (menu_count >= TAGMENU_MAX_MENUS)
{
logf("max menucount reached");
return false;
}
if (get_token_str(menu->id, sizeof(menu->id)) < 0) if (get_token_str(menu->id, sizeof(menu->id)) < 0)
{ {
logf("%menu_start id empty"); logf("%menu_start id empty");
@ -693,6 +699,12 @@ static bool parse_menu(const char *filename)
continue; continue;
} }
if (menu->itemcount >= TAGMENU_MAX_ITEMS)
{
logf("max itemcount reached");
continue;
}
/* Allocate */ /* Allocate */
if (menu->items[menu->itemcount] == NULL) if (menu->items[menu->itemcount] == NULL)
{ {

View file

@ -22,6 +22,10 @@
#include "tagcache.h" #include "tagcache.h"
#include "tree.h" #include "tree.h"
#define TAGNAVI_VERSION "#! rockbox/tagbrowser/2.0"
#define TAGMENU_MAX_ITEMS 32
#define TAGMENU_MAX_MENUS 16
enum table { root = 1, navibrowse, allsubentries, playtrack }; enum table { root = 1, navibrowse, allsubentries, playtrack };
struct tagentry { struct tagentry {