sprintf->snprintf, fix some too short buffers

This commit is contained in:
Henrik Rydgard committed 2014-09-14 00:14:11 +02:00
1 parent 170e88838f
commit f84ebf6bff
18 files changed
+66 -65

No files matched your search

+5 -5
View File
@@ -289,11 +289,11 @@ namespace SaveState
std::string GenerateSaveSlotFilename(int slot, const char *extension)
{
char discID[256];
char temp[256];
sprintf(discID, "%s_%s",
char temp[2048];
snprintf(discID, sizeof(discID), "%s_%s",
g_paramSFO.GetValueString("DISC_ID").c_str(),
g_paramSFO.GetValueString("DISC_VERSION").c_str());
sprintf(temp, "ms0:/PSP/PPSSPP_STATE/%s_%i.%s", discID, slot, extension);
snprintf(temp, sizeof(temp), "ms0:/PSP/PPSSPP_STATE/%s_%i.%s", discID, slot, extension);
std::string hostPath;
if (pspFileSystem.GetHostPath(std::string(temp), hostPath)) {
return hostPath;
@@ -306,8 +306,8 @@ namespace SaveState
{
I18NCategory *sy = GetI18NCategory("System");
g_Config.iCurrentStateSlot = (g_Config.iCurrentStateSlot + 1) % SaveState::SAVESTATESLOTS;
char msg[30];
sprintf(msg, "%s: %d", sy->T("Savestate Slot"), g_Config.iCurrentStateSlot + 1);
char msg[128];
snprintf(msg, sizeof(msg), "%s: %d", sy->T("Savestate Slot"), g_Config.iCurrentStateSlot + 1);
osm.Show(msg);
}