[Scummvm-cvs-logs] CVS: scummvm script_v1.cpp,1.130,1.131

James Brown ender at users.sourceforge.net
Thu Aug 1 14:46:12 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv23037

Modified Files:
	script_v1.cpp 
Log Message:
Don't be an idiot, null terminate strings. :)



Index: script_v1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/script_v1.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- script_v1.cpp	1 Aug 2002 09:27:50 -0000	1.130
+++ script_v1.cpp	1 Aug 2002 09:36:07 -0000	1.131
@@ -2129,6 +2129,7 @@
 			work[i++] = fetchScriptByte();
 		}
 	}
+	work[i] = 0;
 
 	if (obj < NUM_ACTORS)
 		error("Can't set actor %d name with new-name-of", obj);
@@ -2136,7 +2137,7 @@
 	if (!getOBCDFromObject(obj)) {
 		// FIXME: Bug 587553. This is an odd one and looks more like
 		// an actual bug in the original script. Usually we would error
-		warning("Can't find OBCD to rename object %d to %s", obj, name);
+		warning("Can't find OBCD to rename object %d to %s", obj, work);
 		return;
 	}
 
@@ -2157,12 +2158,10 @@
 	}
 
 	if (i >= size) {
-		work[i] = 0;
 		warning("New name of object %d too long (old *%s* new *%s*)", obj, name, work);
 		i = size - 1;
 	}
 
-	work[i] = 0;
 	strcpy((char *)name, (char *)work);
 	runHook(0);
 }





More information about the Scummvm-git-logs mailing list