[Scummvm-cvs-logs] SF.net SVN: scummvm:[48091] scummvm/trunk/engines/cruise

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Fri Feb 19 23:26:30 CET 2010


Revision: 48091
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48091&view=rev
Author:   dreammaster
Date:     2010-02-19 22:26:30 +0000 (Fri, 19 Feb 2010)

Log Message:
-----------
Increased the amount of space for storing background filenames to fix memory overflow

Modified Paths:
--------------
    scummvm/trunk/engines/cruise/background.cpp
    scummvm/trunk/engines/cruise/background.h

Modified: scummvm/trunk/engines/cruise/background.cpp
===================================================================
--- scummvm/trunk/engines/cruise/background.cpp	2010-02-19 14:16:43 UTC (rev 48090)
+++ scummvm/trunk/engines/cruise/background.cpp	2010-02-19 22:26:30 UTC (rev 48091)
@@ -210,9 +210,13 @@
 
 	MemFree(ptrToFree);
 
-	if (name != backgroundTable[idx].name)
-		strcpy(backgroundTable[idx].name, name);
+	if (name != backgroundTable[idx].name) {
+		if (strlen(name) > sizeof(backgroundTable[idx].name)) 
+			warning("background name length exceeded allowable maximum");
 
+		strncpy(backgroundTable[idx].name, name, sizeof(backgroundTable[idx].name));
+	}
+
 	return (0);
 }
 

Modified: scummvm/trunk/engines/cruise/background.h
===================================================================
--- scummvm/trunk/engines/cruise/background.h	2010-02-19 14:16:43 UTC (rev 48090)
+++ scummvm/trunk/engines/cruise/background.h	2010-02-19 22:26:30 UTC (rev 48091)
@@ -29,7 +29,7 @@
 namespace Cruise {
 
 struct backgroundTableStruct {
-	char name[9];
+	char name[16];
 	char extention[6];
 };
 


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