AGI: Don't use unsafe strcat and strcpy

This commit is contained in:
Le Philousophe 2022-09-24 12:29:37 +02:00 committed by Eugene Sandulenko
parent d8a4c106dd
commit c89f760066
3 changed files with 4 additions and 4 deletions

View File

@ -205,10 +205,10 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const {
break;
}
if (descriptionPos >= sizeof(description)) {
strcpy(description, "[broken saved game]");
Common::strcpy_s(description, "[broken saved game]");
}
} else {
strcpy(description, "[not an AGI saved game]");
Common::strcpy_s(description, "[not an AGI saved game]");
}
delete in;

View File

@ -614,7 +614,7 @@ void MickeyEngine::patchMenu(MSA_MENU *menu) {
// change planet name in ship airlock menu
if (_gameStateMickey.iRoom == IDI_MSA_PIC_SHIP_AIRLOCK) {
strcpy((char *)menu->row[1].entry[2].szText, IDS_MSA_NAME_PLANET[_gameStateMickey.iPlanet]);
Common::strcpy_s(menu->row[1].entry[2].szText, IDS_MSA_NAME_PLANET[_gameStateMickey.iPlanet]);
}
// exit if fix unnecessary

View File

@ -436,7 +436,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
// this fact in the debug output. The string saved in "md5" will never match
// any valid MD5 sum, thus it is safe to do that here.
if (md5[0] == 0)
strcpy(md5, "fallback matched");
Common::strcpy_s(md5, "fallback matched");
debug(0, "Saved game MD5: \"%s\"", md5);