From 8941a96bf0742b35e04741d9841d4c1430201baa Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 30 Jul 2008 08:23:04 +0000 Subject: Make sure that save game descriptions are 0-terminated svn-id: r33438 --- engines/tinsel/saveload.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/tinsel') diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp index 5cb149eb37..1a6cc1202a 100644 --- a/engines/tinsel/saveload.cpp +++ b/engines/tinsel/saveload.cpp @@ -136,6 +136,7 @@ static bool syncSaveGameHeader(Serializer &s, SaveGameHeader &hdr) { s.syncAsUint32LE(hdr.ver); s.syncBytes((byte *)hdr.desc, SG_DESC_LEN); + hdr.desc[SG_DESC_LEN - 1] = 0; syncTime(s, hdr.dateTime); @@ -291,6 +292,7 @@ int getList(void) { 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; savedFiles[i].dateTime = hdr.dateTime; ++numSfiles; @@ -405,6 +407,7 @@ static void DoSave(void) { hdr.size = SAVEGAME_HEADER_SIZE; hdr.ver = CURRENT_VER; memcpy(hdr.desc, SaveSceneDesc, SG_DESC_LEN); + hdr.desc[SG_DESC_LEN - 1] = 0; g_system->getTimeAndDate(hdr.dateTime); if (!syncSaveGameHeader(s, hdr) || f->ioFailed()) { goto save_failure; -- cgit v1.2.3