fix compilation without gperftools (#87)
* fix compilation without gperftools the -ltcmalloc get pulled in by gperftools * fix buffer overflow This might not be the last one... * fix potential buffer overflow Some still remain because I'm unsure of their function. Just simple fixes for now. * fix even more potential overflows Those need testing. It seems a lot variables are hardcoded there but since it matches NAME_MAX it should be safe to use 255 as a value.
This commit is contained in:
parent
4b6ecbaab7
commit
f1b82ee041
6 changed files with 16 additions and 15 deletions
3
Makefile
3
Makefile
|
@ -39,7 +39,7 @@ MORE_CFLAGS += -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/guisan/incl
|
||||||
MORE_CFLAGS += -Wno-unused -Wno-format -DGCCCONSTFUNC="__attribute__((const))"
|
MORE_CFLAGS += -Wno-unused -Wno-format -DGCCCONSTFUNC="__attribute__((const))"
|
||||||
MORE_CFLAGS += -fexceptions -fpermissive
|
MORE_CFLAGS += -fexceptions -fpermissive
|
||||||
|
|
||||||
LDFLAGS += -lpthread -lm -lz -lpng -lrt -lxml2 -lFLAC -lmpg123 -ldl
|
LDFLAGS += -lpthread -lm -lz -lpng -lrt -lxml2 -lFLAC -lmpg123 -ldl
|
||||||
LDFLAGS += -lSDL2 -lSDL2_image -lSDL2_ttf -lguisan -L/opt/vc/lib -Lsrc/guisan/lib
|
LDFLAGS += -lSDL2 -lSDL2_image -lSDL2_ttf -lguisan -L/opt/vc/lib -Lsrc/guisan/lib
|
||||||
|
|
||||||
ifndef DEBUG
|
ifndef DEBUG
|
||||||
|
@ -48,6 +48,7 @@ else
|
||||||
MORE_CFLAGS += -g -DDEBUG -Wl,--export-dynamic
|
MORE_CFLAGS += -g -DDEBUG -Wl,--export-dynamic
|
||||||
MORE_CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
|
MORE_CFLAGS += -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
|
||||||
LDFLAGS += -ltcmalloc -lprofiler
|
LDFLAGS += -ltcmalloc -lprofiler
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ASFLAGS += $(CPU_FLAGS)
|
ASFLAGS += $(CPU_FLAGS)
|
||||||
|
|
|
@ -702,7 +702,7 @@ int main(int argc, char* argv[])
|
||||||
loadAdfDir();
|
loadAdfDir();
|
||||||
rp9_init();
|
rp9_init();
|
||||||
|
|
||||||
snprintf(savestate_fname, MAX_PATH, "%s/saves/default.ads", start_path_data);
|
snprintf(savestate_fname, MAX_DPATH, "%s/saves/default.ads", start_path_data);
|
||||||
logging_init();
|
logging_init();
|
||||||
|
|
||||||
memset(&action, 0, sizeof(action));
|
memset(&action, 0, sizeof(action));
|
||||||
|
|
|
@ -282,8 +282,8 @@ void RescanROMs()
|
||||||
for (int i = 0; i < files.size(); ++i)
|
for (int i = 0; i < files.size(); ++i)
|
||||||
{
|
{
|
||||||
char tmppath[MAX_PATH];
|
char tmppath[MAX_PATH];
|
||||||
strncpy(tmppath, path, MAX_PATH);
|
strncpy(tmppath, path, MAX_DPATH);
|
||||||
strncat(tmppath, files[i].c_str(), MAX_PATH);
|
strncat(tmppath, files[i].c_str(), MAX_DPATH);
|
||||||
scan_rom(tmppath);
|
scan_rom(tmppath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ void gui_purge_events()
|
||||||
|
|
||||||
int gui_update()
|
int gui_update()
|
||||||
{
|
{
|
||||||
char tmp[MAX_PATH];
|
char tmp[MAX_DPATH];
|
||||||
|
|
||||||
fetch_statefilepath(savestate_fname, MAX_DPATH);
|
fetch_statefilepath(savestate_fname, MAX_DPATH);
|
||||||
fetch_screenshotpath(screenshot_filename, MAX_DPATH);
|
fetch_screenshotpath(screenshot_filename, MAX_DPATH);
|
||||||
|
@ -518,7 +518,7 @@ int gui_update()
|
||||||
if (strlen(currprefs.floppyslots[0].df) > 0)
|
if (strlen(currprefs.floppyslots[0].df) > 0)
|
||||||
extractFileName(currprefs.floppyslots[0].df, tmp);
|
extractFileName(currprefs.floppyslots[0].df, tmp);
|
||||||
else
|
else
|
||||||
strncpy(tmp, last_loaded_config, MAX_PATH);
|
strncpy(tmp, last_loaded_config, MAX_DPATH);
|
||||||
|
|
||||||
strncat(savestate_fname, tmp, MAX_DPATH);
|
strncat(savestate_fname, tmp, MAX_DPATH);
|
||||||
strncat(screenshot_filename, tmp, MAX_DPATH);
|
strncat(screenshot_filename, tmp, MAX_DPATH);
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
if (strlen(ConfigFilesList[i]->Description) > 0)
|
if (strlen(ConfigFilesList[i]->Description) > 0)
|
||||||
{
|
{
|
||||||
strncat(tmp, " (", MAX_DPATH);
|
strncat(tmp, " (", MAX_DPATH);
|
||||||
strncat(tmp, ConfigFilesList[i]->Description, MAX_DPATH);
|
strncat(tmp, ConfigFilesList[i]->Description, 255);
|
||||||
strncat(tmp, ")", MAX_DPATH);
|
strncat(tmp, ")", MAX_DPATH);
|
||||||
}
|
}
|
||||||
configs.push_back(tmp);
|
configs.push_back(tmp);
|
||||||
|
@ -151,9 +151,9 @@ public:
|
||||||
if (!txtName->getText().empty())
|
if (!txtName->getText().empty())
|
||||||
{
|
{
|
||||||
fetch_configurationpath(filename, MAX_DPATH);
|
fetch_configurationpath(filename, MAX_DPATH);
|
||||||
strncat(filename, txtName->getText().c_str(), MAX_DPATH);
|
strncat(filename, txtName->getText().c_str(), 255);
|
||||||
strncat(filename, ".uae", MAX_DPATH);
|
strncat(filename, ".uae", MAX_DPATH);
|
||||||
strncpy(changed_prefs.description, txtDesc->getText().c_str(), 256);
|
strncpy(changed_prefs.description, txtDesc->getText().c_str(), 255);
|
||||||
if (cfgfile_save(&changed_prefs, filename, 0))
|
if (cfgfile_save(&changed_prefs, filename, 0))
|
||||||
RefreshPanelConfig();
|
RefreshPanelConfig();
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,17 +289,17 @@ public:
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
if (strlen(changed_prefs.floppyslots[0].df) > 0)
|
if (strlen(changed_prefs.floppyslots[0].df) > 0)
|
||||||
{
|
{
|
||||||
char filename[MAX_DPATH];
|
char filename[MAX_PATH];
|
||||||
char diskname[MAX_PATH];
|
char diskname[MAX_DPATH];
|
||||||
|
|
||||||
extractFileName(changed_prefs.floppyslots[0].df, diskname);
|
extractFileName(changed_prefs.floppyslots[0].df, diskname);
|
||||||
removeFileExtension(diskname);
|
removeFileExtension(diskname);
|
||||||
|
|
||||||
fetch_configurationpath(filename, MAX_DPATH);
|
fetch_configurationpath(filename, MAX_PATH);
|
||||||
strncat(filename, diskname, MAX_DPATH);
|
strncat(filename, diskname, MAX_DPATH);
|
||||||
strncat(filename, ".uae", MAX_DPATH);
|
strncat(filename, ".uae", MAX_PATH);
|
||||||
|
|
||||||
snprintf(changed_prefs.description, MAX_PATH, "Configuration for disk '%s'", diskname);
|
snprintf(changed_prefs.description, 255, "Configuration for disk '%s'", diskname);
|
||||||
if (cfgfile_save(&changed_prefs, filename, 0))
|
if (cfgfile_save(&changed_prefs, filename, 0))
|
||||||
RefreshPanelConfig();
|
RefreshPanelConfig();
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ static bool CheckKickstart(struct uae_prefs* p)
|
||||||
|
|
||||||
// Search via filename
|
// Search via filename
|
||||||
fetch_rompath(kickpath, MAX_DPATH);
|
fetch_rompath(kickpath, MAX_DPATH);
|
||||||
strncat(kickpath, kickstarts_rom_names[kickstart], MAX_DPATH);
|
strncat(kickpath, kickstarts_rom_names[kickstart], 255);
|
||||||
for (i = 0; i < lstAvailableROMs.size(); ++i)
|
for (i = 0; i < lstAvailableROMs.size(); ++i)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(lstAvailableROMs[i]->Path, kickpath))
|
if (!strcasecmp(lstAvailableROMs[i]->Path, kickpath))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue