diff options
author | Filippos Karapetis | 2012-05-26 16:23:03 +0300 |
---|---|---|
committer | Filippos Karapetis | 2012-05-26 16:23:03 +0300 |
commit | 79926b305cada849e7881b4d10b8dc1ea8ad522a (patch) | |
tree | 3d91b79f5887e41183462047113915f203753d74 | |
parent | beef27fc10bb714fe37f2ee0c35cd143dc706829 (diff) | |
download | scummvm-rg350-79926b305cada849e7881b4d10b8dc1ea8ad522a.tar.gz scummvm-rg350-79926b305cada849e7881b4d10b8dc1ea8ad522a.tar.bz2 scummvm-rg350-79926b305cada849e7881b4d10b8dc1ea8ad522a.zip |
SCI: Bugfix for kFileIOReadRaw
Avoid overwriting the target buffer with junk when no data has been read
-rw-r--r-- | engines/sci/engine/kfile.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index af438bdaff..b1f85227c1 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -812,7 +812,8 @@ reg_t kFileIOReadRaw(EngineState *s, int argc, reg_t *argv) { FileHandle *f = getFileFromHandle(s, handle); if (f) { bytesRead = f->_in->read(buf, size); - s->_segMan->memcpy(argv[1], (const byte*)buf, size); + if (bytesRead > 0) + s->_segMan->memcpy(argv[1], (const byte*)buf, size); } delete[] buf; |