[Scummvm-cvs-logs] SF.net SVN: scummvm: [22627] scummvm/trunk/engines/agi/id.cpp

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Thu May 25 08:12:34 CEST 2006


Revision: 22627
Author:   wjpalenstijn
Date:     2006-05-25 08:06:55 -0700 (Thu, 25 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22627&view=rev

Log Message:
-----------
fix out-of-bounds array access

Modified Paths:
--------------
    scummvm/trunk/engines/agi/id.cpp
Modified: scummvm/trunk/engines/agi/id.cpp
===================================================================
--- scummvm/trunk/engines/agi/id.cpp	2006-05-25 12:17:50 UTC (rev 22626)
+++ scummvm/trunk/engines/agi/id.cpp	2006-05-25 15:06:55 UTC (rev 22627)
@@ -242,11 +242,12 @@
 		if (c)
 			*c = 0;
 
-		/* Remove spaces at end of line */
+		/* Remove spaces/tabs at end of line */
 		if (strlen(buf)) {
-			for (c = buf + strlen(buf) - 1;
-			    *c == ' ' || *c == '\t'; *c-- = 0) {
-			}
+			int i;
+			for (i = strlen(buf) - 1;
+				 i >= 0 && (buf[i] == ' ' || buf[i] == '\t');
+				 buf[i--] = 0) { }
 		}
 
 		t = strtok(buf, " \t\r\n");


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