X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FloadSave.cpp;h=d77c21f800e16e3e8faf6948f61f944e98471c39;hb=d581939511f482a3bfdaba7f6470de8939e6cd5e;hp=7d2792c3c6fc1c7422ce2fe67d080d64e08e8f48;hpb=a0533dd345e4d7d60bc9cccb724e60875a42292c;p=quix0rs-blobwars.git diff --git a/src/loadSave.cpp b/src/loadSave.cpp index 7d2792c..d77c21f 100644 --- a/src/loadSave.cpp +++ b/src/loadSave.cpp @@ -42,14 +42,14 @@ void initSaveSlots() if (!fp) { - strncpy(string, "%.2d - %s", sizeof string); + strlcpy(string, "%.2d - %s", sizeof string); snprintf(engine.saveSlot[i], sizeof engine.saveSlot[i], string, (i + 1), _("Empty")); } else { if (fread(&tempGame, sizeof(Game), 1, fp) != 1) { - strncpy(string, "%.2d - %s", sizeof string); + strlcpy(string, "%.2d - %s", sizeof string); snprintf(engine.saveSlot[i], sizeof engine.saveSlot[i], string, (i + 1), _("Corrupt Save Data")); } else @@ -163,7 +163,7 @@ bool loadGame(int slot) fgets(line, 1024, fp); sscanf(line, "%[^\n\r]", string[0]); - strncpy(stageName, string[0], sizeof stageName); + strlcpy(stageName, string[0], sizeof stageName); if (strcmp(stageName, "@EOF@") == 0) { @@ -183,7 +183,7 @@ bool loadGame(int slot) fgets(line, 1024, fp); - strncpy(persistData->data, line, sizeof persistData->data); + strlcpy(persistData->data, line, sizeof persistData->data); //debug(("Read %d: %s", i, persistData->data)); @@ -237,7 +237,7 @@ int confirmSave() for (int i = 0 ; i < 5 ; i++) { snprintf(widgetName, sizeof widgetName, "slot%d", i + 1); - strncpy(engine.getWidgetByName(widgetName)->label, engine.saveSlot[i], sizeof engine.getWidgetByName(widgetName)->label); + strlcpy(engine.getWidgetByName(widgetName)->label, engine.saveSlot[i], sizeof engine.getWidgetByName(widgetName)->label); } engine.highlightWidget("slot1");