diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2006-09-21 17:16:35 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-09-21 17:16:35 +0000 |
commit | 1dc35774bf28a2b47c7e40e0c170d508893a761c (patch) | |
tree | b4e95d8327532329a7de14ead73425970495c4b8 | |
parent | 2692c4e27856f7cb29b20fe67769952a02bc9e9a (diff) |
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
-rw-r--r-- | apps/tagtree.c | 18 | ||||
-rw-r--r-- | apps/tagtree.h | 4 |
2 files changed, 19 insertions, 3 deletions
diff --git a/apps/tagtree.c b/apps/tagtree.c index d03623b295..06239c4458 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -107,9 +107,6 @@ struct menu_entry { int link; }; -#define TAGNAVI_VERSION "#! rockbox/tagbrowser/2.0" -#define TAGMENU_MAX_ITEMS 32 -#define TAGMENU_MAX_MENUS 8 struct root_menu { char title[64]; char id[32]; @@ -596,7 +593,10 @@ static bool parse_menu(const char *filename) int i; if (menu_count >= TAGMENU_MAX_MENUS) + { + logf("max menucount reached"); return false; + } fd = open(filename, O_RDONLY); if (fd < 0) @@ -659,6 +659,12 @@ static bool parse_menu(const char *filename) break; 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) { logf("%menu_start id empty"); @@ -693,6 +699,12 @@ static bool parse_menu(const char *filename) continue; } + if (menu->itemcount >= TAGMENU_MAX_ITEMS) + { + logf("max itemcount reached"); + continue; + } + /* Allocate */ if (menu->items[menu->itemcount] == NULL) { diff --git a/apps/tagtree.h b/apps/tagtree.h index 30e00f6c99..f3f1103d90 100644 --- a/apps/tagtree.h +++ b/apps/tagtree.h @@ -22,6 +22,10 @@ #include "tagcache.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 }; struct tagentry { |