diff options
-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 { | |||
107 | int link; | 107 | int link; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | #define TAGNAVI_VERSION "#! rockbox/tagbrowser/2.0" | ||
111 | #define TAGMENU_MAX_ITEMS 32 | ||
112 | #define TAGMENU_MAX_MENUS 8 | ||
113 | struct root_menu { | 110 | struct root_menu { |
114 | char title[64]; | 111 | char title[64]; |
115 | char id[32]; | 112 | char id[32]; |
@@ -596,7 +593,10 @@ static bool parse_menu(const char *filename) | |||
596 | int i; | 593 | int i; |
597 | 594 | ||
598 | if (menu_count >= TAGMENU_MAX_MENUS) | 595 | if (menu_count >= TAGMENU_MAX_MENUS) |
596 | { | ||
597 | logf("max menucount reached"); | ||
599 | return false; | 598 | return false; |
599 | } | ||
600 | 600 | ||
601 | fd = open(filename, O_RDONLY); | 601 | fd = open(filename, O_RDONLY); |
602 | if (fd < 0) | 602 | if (fd < 0) |
@@ -659,6 +659,12 @@ static bool parse_menu(const char *filename) | |||
659 | break; | 659 | break; |
660 | 660 | ||
661 | case var_menu_start: | 661 | case var_menu_start: |
662 | if (menu_count >= TAGMENU_MAX_MENUS) | ||
663 | { | ||
664 | logf("max menucount reached"); | ||
665 | return false; | ||
666 | } | ||
667 | |||
662 | if (get_token_str(menu->id, sizeof(menu->id)) < 0) | 668 | if (get_token_str(menu->id, sizeof(menu->id)) < 0) |
663 | { | 669 | { |
664 | logf("%menu_start id empty"); | 670 | logf("%menu_start id empty"); |
@@ -693,6 +699,12 @@ static bool parse_menu(const char *filename) | |||
693 | continue; | 699 | continue; |
694 | } | 700 | } |
695 | 701 | ||
702 | if (menu->itemcount >= TAGMENU_MAX_ITEMS) | ||
703 | { | ||
704 | logf("max itemcount reached"); | ||
705 | continue; | ||
706 | } | ||
707 | |||
696 | /* Allocate */ | 708 | /* Allocate */ |
697 | if (menu->items[menu->itemcount] == NULL) | 709 | if (menu->items[menu->itemcount] == NULL) |
698 | { | 710 | { |
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 @@ | |||
22 | #include "tagcache.h" | 22 | #include "tagcache.h" |
23 | #include "tree.h" | 23 | #include "tree.h" |
24 | 24 | ||
25 | #define TAGNAVI_VERSION "#! rockbox/tagbrowser/2.0" | ||
26 | #define TAGMENU_MAX_ITEMS 32 | ||
27 | #define TAGMENU_MAX_MENUS 16 | ||
28 | |||
25 | enum table { root = 1, navibrowse, allsubentries, playtrack }; | 29 | enum table { root = 1, navibrowse, allsubentries, playtrack }; |
26 | 30 | ||
27 | struct tagentry { | 31 | struct tagentry { |