aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tinsel')
-rw-r--r--engines/tinsel/detection.cpp4
-rw-r--r--engines/tinsel/handle.cpp3
-rw-r--r--engines/tinsel/saveload.cpp5
3 files changed, 4 insertions, 8 deletions
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 49fc817b34..70a2f475ee 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -954,9 +954,7 @@ Common::Error TinselEngine::loadGameState(int slot) {
Common::Error TinselEngine::saveGameState(int slot, const char *desc) {
Common::String saveName = _vm->getSavegameFilename((int16)(slot + 1));
char saveDesc[SG_DESC_LEN];
- strncpy(saveDesc, desc, SG_DESC_LEN);
- // Make sure that saveDesc is 0-terminated
- saveDesc[SG_DESC_LEN - 1] = '\0';
+ Common::strlcpy(saveDesc, desc, SG_DESC_LEN);
SaveGame((char *)saveName.c_str(), saveDesc);
ProcessSRQueue(); // This shouldn't be needed, but for some reason it is...
return Common::kNoError; // TODO: return success/failure
diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index e26ff9218e..de573feee2 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -288,8 +288,7 @@ void LoadFile(MEMHANDLE *pH) {
}
// extract and zero terminate the filename
- strncpy(szFilename, pH->szName, sizeof(pH->szName));
- szFilename[sizeof(pH->szName)] = 0;
+ Common::strlcpy(szFilename, pH->szName, sizeof(pH->szName));
if (f.open(szFilename)) {
// read the data
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index c56d295e72..b90ace4613 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -365,9 +365,8 @@ int getList(Common::SaveFileManager *saveFileMan, const Common::String &target)
}
#endif
- strncpy(savedFiles[i].name, fname.c_str(), FNAMELEN);
- strncpy(savedFiles[i].desc, hdr.desc, SG_DESC_LEN);
- savedFiles[i].desc[SG_DESC_LEN - 1] = 0;
+ Common::strlcpy(savedFiles[i].name, fname.c_str(), FNAMELEN);
+ Common::strlcpy(savedFiles[i].desc, hdr.desc, SG_DESC_LEN);
savedFiles[i].dateTime = hdr.dateTime;
++numSfiles;