From 10e5e56f3c62383afba30b553fac1ee624a8428d Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 20 Sep 2019 03:07:29 -0500 Subject: Bug fix dynamic menus Dynamic menus had a buffer_len variable in the parent function but it was discarded before passing to the callbacks Why!!?? No clue but everything that used it was assuming MAXPATH Wouldn't be surprised to see some bugs pop out from this one.. init_menu_lists() was assuming MENU_HAS_DESC and setting the menu title + icon based on such even though it could be invalid didn't see anywhere in the code that was currently using MENU_DYNAMIC_DESC in relation to a top level menu but considering it caused all kinds of corruption to the menu when I tried its probably been tried and abandoned before... Change-Id: I8d961d748918bfa8ea6adb5ad60491af4d739d6e --- apps/menus/radio_menu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'apps/menus/radio_menu.c') diff --git a/apps/menus/radio_menu.c b/apps/menus/radio_menu.c index fb3d2b7fee..8871421c11 100644 --- a/apps/menus/radio_menu.c +++ b/apps/menus/radio_menu.c @@ -100,11 +100,12 @@ MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL); #ifndef FM_MODE extern int radio_mode; -static char* get_mode_text(int selected_item, void * data, char *buffer) +static char* get_mode_text(int selected_item, void * data, + char *buffer, size_t buffer_len) { (void)selected_item; (void)data; - snprintf(buffer, MAX_PATH, "%s %s", str(LANG_MODE), + snprintf(buffer, buffer_len, "%s %s", str(LANG_MODE), radio_mode ? str(LANG_PRESET) : str(LANG_RADIO_SCAN_MODE)); return buffer; -- cgit v1.2.3