aboutsummaryrefslogtreecommitdiff
path: root/scumm/saveload.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-04-20 07:10:13 +0000
committerTorbjörn Andersson2004-04-20 07:10:13 +0000
commitac967bde630457fbaf2220145ee048abda652cfe (patch)
treebef66caa7aed3524a44c36fad53a04de17944e93 /scumm/saveload.cpp
parent9defe4fc1880ab8926c5cdf167f35985c7ee9afc (diff)
downloadscummvm-rg350-ac967bde630457fbaf2220145ee048abda652cfe.tar.gz
scummvm-rg350-ac967bde630457fbaf2220145ee048abda652cfe.tar.bz2
scummvm-rg350-ac967bde630457fbaf2220145ee048abda652cfe.zip
Increased _numNewNames from 50 to 100 to prevent overflow in MI2 endgame.
This should fix bug #936323. (There are still some game versions that use 50, but that can be fixed later, if the need arises.) svn-id: r13598
Diffstat (limited to 'scumm/saveload.cpp')
-rw-r--r--scumm/saveload.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index cea086a5b6..51a090b87a 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -823,7 +823,13 @@ void ScummEngine::saveLoadResource(Serializer *ser, int type, int idx) {
_inventory[idx] = ser->loadUint16();
}
if (type == rtObjectName && ser->getVersion() >= VER(25)) {
- _newNames[idx] = ser->loadUint16();
+ // Paranoia: We increased the possible number of new names
+ // for MI2 to fix bug #936323. The savegame format didn't
+ // change, but at least during the transition period there
+ // is a slight chance that we try to load more names than
+ // we have allocated space for. If so, discard them.
+ if (idx < _numNewNames)
+ _newNames[idx] = ser->loadUint16();
}
}
}