aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-05-31 13:36:37 +0200
committerEugene Sandulenko2016-05-31 17:12:18 +0200
commitf225442ad00b4f6a9210731e33bbb5b8a9705ffa (patch)
tree71e46ac6e20f352c9e09a586ebc279423e5b87c8
parent89890523c236681ebf32922d956587c9b44e270d (diff)
downloadscummvm-rg350-f225442ad00b4f6a9210731e33bbb5b8a9705ffa.tar.gz
scummvm-rg350-f225442ad00b4f6a9210731e33bbb5b8a9705ffa.tar.bz2
scummvm-rg350-f225442ad00b4f6a9210731e33bbb5b8a9705ffa.zip
TINSEL: Fix illegal memory reads.
In case of "unnamed" case (see line 582) we were memcpy'ing 31 byte from the heap.
-rw-r--r--engines/tinsel/saveload.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 226cbb51c0..c8fe5f898c 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -594,8 +594,8 @@ static void DoSave() {
hdr.id = SAVEGAME_ID;
hdr.size = SAVEGAME_HEADER_SIZE;
hdr.ver = CURRENT_VER;
- memcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN);
- hdr.desc[SG_DESC_LEN - 1] = 0;
+ memset(hdr.desc, 0, SG_DESC_LEN);
+ Common::strlcpy(hdr.desc, g_SaveSceneDesc, SG_DESC_LEN);
g_system->getTimeAndDate(hdr.dateTime);
hdr.scnFlag = _vm->getFeatures() & GF_SCNFILES;
hdr.language = _vm->_config->_language;