Fixed string warnings with gcc 8.1.0.

This commit is contained in:
yellows8 2018-05-09 21:24:38 -04:00
parent bbf6bf50f7
commit 94b1d648d1
4 changed files with 9 additions and 7 deletions

View File

@ -133,6 +133,7 @@ int menuScan(const char* target) {
continue;
strncpy(me->path, tmp_path, sizeof(me->path)-1);
me->path[sizeof(me->path)-1] = 0;
if (menuEntryLoad(me, dp->d_name, shortcut))
menuAddEntry(me);
else

View File

@ -5,7 +5,7 @@
#include "invalid_icon_bin.h"
#include "folder_icon_bin.h"
char rootPath[PATH_MAX];
char rootPath[PATH_MAX+8];
char *menuGetRootPath() {
return rootPath;
@ -248,14 +248,14 @@ void computeFrontGradient(color_t baseColor, int height) {
}
void menuStartup() {
char tmp_path[PATH_MAX];
#ifdef __SWITCH__
strcpy(rootPath,"sdmc:");
strcpy(tmp_path,"sdmc:");
#else
getcwd(rootPath, PATH_MAX);
getcwd(tmp_path, PATH_MAX);
#endif
sprintf(rootPath,"%s%s%s" , rootPath, DIRECTORY_SEPARATOR, "switch" );
snprintf(rootPath, sizeof(rootPath)-1, "%s%s%s", tmp_path, DIRECTORY_SEPARATOR, "switch");
menuScan(rootPath);

View File

@ -46,7 +46,7 @@ struct menuEntry_s_tag
menuEntry_s* next;
MenuEntryType type;
char path[PATH_MAX+1];
char path[PATH_MAX+8];
argData_s args;
char name[ENTRY_NAMELENGTH+1];

View File

@ -329,7 +329,8 @@ int loadnro(menuEntry_s *me, int sock, struct in_addr remote) {
sanitisePath(filename);
snprintf(me->path, PATH_MAX, "%s%s%s", menuGetRootPath(), DIRECTORY_SEPARATOR, filename);
snprintf(me->path, sizeof(me->path)-1, "%s%s%s", menuGetRootPath(), DIRECTORY_SEPARATOR, filename);
me->path[PATH_MAX] = 0;
// make sure it's terminated
me->path[PATH_MAX] = 0;