aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-12-28 01:39:01 +0100
committerJohannes Schickel2011-12-28 01:40:29 +0100
commitae8ab8d94e53ce94330987705da2353f7e146ba5 (patch)
tree400c253402e4cf3beb664ddf7453a4acc7995302
parent5492307982b3af117f2314cc22c680b48afe9689 (diff)
downloadscummvm-rg350-ae8ab8d94e53ce94330987705da2353f7e146ba5.tar.gz
scummvm-rg350-ae8ab8d94e53ce94330987705da2353f7e146ba5.tar.bz2
scummvm-rg350-ae8ab8d94e53ce94330987705da2353f7e146ba5.zip
KYRA: Silence some valgrind warnings by doing a slight sanity check on savefile size.
-rw-r--r--engines/kyra/saveload.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp
index f4fd4668ee..41ba1e5e50 100644
--- a/engines/kyra/saveload.cpp
+++ b/engines/kyra/saveload.cpp
@@ -60,6 +60,9 @@ KyraEngine_v1::kReadSaveHeaderError KyraEngine_v1::readSaveHeader(Common::Seekab
bool saveOk = false;
for (uint i = 0; i < ARRAYSIZE(descriptionSize) && !saveOk; ++i) {
+ if (in->size() < descriptionSize[i] + 6)
+ continue;
+
in->seek(0, SEEK_SET);
in->read(descriptionBuffer, descriptionSize[i]);
descriptionBuffer[descriptionSize[i]] = 0;