diff --git a/apps/filetypes.c b/apps/filetypes.c index 1e7224a4e2..090898a3af 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -241,7 +241,7 @@ void filetype_init(void) #ifdef HAVE_LCD_COLOR /* the extra item here is for the unknown types which use the last array element */ - custom_colors = (int*)buffer_alloc(sizeof(int)*max_types+1); + custom_colors = (int*)buffer_alloc(sizeof(int)*(max_types+1)); #endif /* set the directory item first */ filetypes[0].extension = NULL; diff --git a/apps/settings.c b/apps/settings.c index 8b826066a1..f2bb542928 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -143,15 +143,22 @@ static bool read_nvram_data(char* buf, int max_len) /* all good, so read in the settings */ var_count = buf[3]; buf_pos = NVRAM_DATA_START; - for(i=0; (i0) && (buf_pos>F_NVRAM_MASK_SHIFT; if (nvram_bytes) { - memcpy(settings[i].setting,&buf[buf_pos],nvram_bytes); - buf_pos += nvram_bytes; - var_count--; + if ((var_count>0) && (buf_pos