diff options
author | Johannes Schickel | 2008-08-02 11:40:09 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-08-02 11:40:09 +0000 |
commit | 8c5360c8331e82208d56de8a82bacd95f7d010d6 (patch) | |
tree | bacd712b6a028add7ad6ac60dea98a49cfae5148 /engines | |
parent | c349a8dcd914656e9d960337bfea7d9d84bd081b (diff) | |
download | scummvm-rg350-8c5360c8331e82208d56de8a82bacd95f7d010d6.tar.gz scummvm-rg350-8c5360c8331e82208d56de8a82bacd95f7d010d6.tar.bz2 scummvm-rg350-8c5360c8331e82208d56de8a82bacd95f7d010d6.zip |
Fix for bug #2035459 "KYRA1: long savegame names cause garbage".
svn-id: r33518
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/gui_lok.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/gui_lok.h | 2 | ||||
-rw-r--r-- | engines/kyra/gui_v2.h | 2 | ||||
-rw-r--r-- | engines/kyra/saveload.cpp | 3 |
4 files changed, 6 insertions, 3 deletions
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index 35b343fc25..11c13319d8 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -673,7 +673,7 @@ void GUI_LoK::updateSavegameString() { length = strlen(_savegameName); if (_keyPressed.ascii > 31 && _keyPressed.ascii < 127) { - if (length < 31) { + if (length < ARRAYSIZE(_savegameName)-1) { _savegameName[length] = _keyPressed.ascii; _savegameName[length+1] = 0; redrawTextfield(); diff --git a/engines/kyra/gui_lok.h b/engines/kyra/gui_lok.h index 49081c7ae2..92b72fd059 100644 --- a/engines/kyra/gui_lok.h +++ b/engines/kyra/gui_lok.h @@ -162,7 +162,7 @@ private: bool _menuRestoreScreen; uint8 _toplevelMenu; int _savegameOffset; - char _savegameName[31]; + char _savegameName[40]; const char *_specialSavegameString; Common::KeyState _keyPressed; int8 _mouseWheel; diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h index 161752627b..60b7f0ab86 100644 --- a/engines/kyra/gui_v2.h +++ b/engines/kyra/gui_v2.h @@ -188,7 +188,7 @@ protected: // save menu bool _noSaveProcess; int _saveSlot; - char _saveDescription[0x50]; + char _saveDescription[0x51]; int saveMenu(Button *caller); int clickSaveSlot(Button *caller); diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index 22f934ba69..8bed4e57e1 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -95,6 +95,9 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::InSave if (header.version <= 8) { char buffer[31]; in->read(buffer, 31); + // WORKAROUND: Old savegames could contain a missing termination 0 at the + // end so we manually add it. + buffer[30] = 0; header.description = buffer; } else { header.description = ""; |