[Scummvm-cvs-logs] SF.net SVN: scummvm:[46785] scummvm/trunk/engines/gob/script.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Thu Dec 31 01:06:28 CET 2009


Revision: 46785
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46785&view=rev
Author:   drmccoy
Date:     2009-12-31 00:06:28 +0000 (Thu, 31 Dec 2009)

Log Message:
-----------
Make sure that enough data is read out of the script

Modified Paths:
--------------
    scummvm/trunk/engines/gob/script.cpp

Modified: scummvm/trunk/engines/gob/script.cpp
===================================================================
--- scummvm/trunk/engines/gob/script.cpp	2009-12-30 23:21:33 UTC (rev 46784)
+++ scummvm/trunk/engines/gob/script.cpp	2009-12-31 00:06:28 UTC (rev 46785)
@@ -155,9 +155,11 @@
 }
 
 byte Script::readByte() {
-	byte v;
+	byte v = 0;
+	uint32 n;
 
-	read(&v, 1);
+	n = read(&v, 1);
+	assert(n == 1);
 
 	return v;
 }
@@ -171,17 +173,21 @@
 }
 
 uint16 Script::readUint16() {
-	byte v[2];
+	byte v[2] = {0, 0};
+	uint32 n;
 
-	read(v, 2);
+	n = read(v, 2);
+	assert(n == 2);
 
 	return READ_LE_UINT16(v);
 }
 
 uint32 Script::readUint32() {
-	byte v[4];
+	byte v[4] = {0, 0, 0, 0};
+	uint32 n;
 
-	read(v, 4);
+	n = read(v, 4);
+	assert(n == 4);
 
 	return READ_LE_UINT32(v);
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list