diff --git a/source/arm11/menu/menu_fsel.c b/source/arm11/menu/menu_fsel.c index 99d4c0a..07bd97d 100644 --- a/source/arm11/menu/menu_fsel.c +++ b/source/arm11/menu/menu_fsel.c @@ -125,7 +125,7 @@ min0 = cmp1; continue; } - if(strnicmp(min0->fname, cmp1->fname, 256) > 0) + if(strnicmp(min0->fname, cmp1->fname, FF_MAX_LFN + 1) > 0) { min0 = cmp1; } @@ -313,11 +313,11 @@ // res_path has to be at least 256 byte long (including '\0') and // is also used as temporary buffer *res_path = '\0'; // root dir if start is NULL - if(start) strncpy(res_path, start, 256); + if(start) strncpy(res_path, start, FF_MAX_LFN + 1); // handle allow_root if (!allow_root && (strncmp(res_path, "sdmc:", 5) != 0)) - strncpy(res_path, "sdmc:", 256); + strncpy(res_path, "sdmc:", FF_MAX_LFN + 1); // check res_path, fix if required char* lastname = NULL; @@ -356,7 +356,7 @@ { for (s32 i = 0; i < n_entries; i++) { - if (strncmp(dir_buffer[i].fname, lastname, 256) == 0) + if (strncmp(dir_buffer[i].fname, lastname, FF_MAX_LFN + 1) == 0) { index = i; break; @@ -410,7 +410,7 @@ // build new res_path char* name = &(res_path[strlen(res_path)]); if (name > res_path) *(name++) = '/'; - strncpy(name, dir_buffer[index].fname, (256 - (name - res_path))); + strncpy(name, dir_buffer[index].fname, ((FF_MAX_LFN + 1) - (name - res_path))); // is this a dir? is_dir = dir_buffer[index].is_dir; diff --git a/source/arm11/menu/menu_func.c b/source/arm11/menu/menu_func.c index ee84bc0..be40d1a 100644 --- a/source/arm11/menu/menu_func.c +++ b/source/arm11/menu/menu_func.c @@ -151,7 +151,7 @@ if (configDataExist(KBootOption1 + slot)) start = (char*) configGetData(KBootOption1 + slot); - res_path = (char*) malloc(256); + res_path = (char*) malloc(FF_MAX_LFN + 1); if (!res_path) panicMsg("Out of memory"); ee_printf_screen_center("Select a firmware file for slot #%lu.\nPress [HOME] to cancel.", slot + 1); @@ -258,7 +258,7 @@ u32 menuLaunchFirm(PrintConsole* term_con, PrintConsole* menu_con, u32 param) { - char path_store[256]; + char path_store[FF_MAX_LFN + 1]; char* path; // select & clear console @@ -502,7 +502,7 @@ ee_printf_screen_center("Select a NAND backup for restore.\nPress [HOME] to cancel."); updateScreens(); - char fpath[256]; + char fpath[FF_MAX_LFN + 1]; if (!menuFileSelector(fpath, menu_con, NAND_BACKUP_PATH, "*.bin", false)) return 1; // canceled by user @@ -620,7 +620,7 @@ u32 menuInstallFirm(PrintConsole* term_con, PrintConsole* menu_con, u32 param) { char firm_drv[8] = { 'f', 'i', 'r', 'm', '0' + param, ':', '\0' }; - char firm_path[256]; + char firm_path[FF_MAX_LFN + 1]; u32 result = 1; @@ -686,7 +686,7 @@ { (void) param; - char firm_path[256]; + char firm_path[FF_MAX_LFN + 1]; u32 result = 1;