[Scummvm-cvs-logs] SF.net SVN: scummvm:[43879] scummvm/trunk/engines/scumm/he/script_v60he.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Sep 1 15:01:59 CEST 2009


Revision: 43879
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43879&view=rev
Author:   fingolfin
Date:     2009-09-01 13:01:59 +0000 (Tue, 01 Sep 2009)

Log Message:
-----------
SCUMM: Better fix for convertFilePath (use snprintf instead of sprintf, avoid intermediate buffer)

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/he/script_v60he.cpp

Modified: scummvm/trunk/engines/scumm/he/script_v60he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v60he.cpp	2009-09-01 13:00:25 UTC (rev 43878)
+++ scummvm/trunk/engines/scumm/he/script_v60he.cpp	2009-09-01 13:01:59 UTC (rev 43879)
@@ -122,10 +122,8 @@
 	int r = 0;
 	if (dst[len - 3] == 's' && dst[len - 2] == 'g') { // Save Game File
 		// Change filename prefix to target name, for save game files.
-		char saveName[40];
-		memset(saveName, 0, sizeof(saveName));
-		sprintf(saveName, "%s.sg%c", _targetName.c_str(), dst[len - 1]);
-		memcpy(dst, saveName, 40);
+		const char c = dst[len - 1];
+		snprintf((char *)dst, dstSize, "%s.sg%c", _targetName.c_str(), c);
 	} else if (dst[0] == '.' && dst[1] == '/') { // Game Data Path
 		// The default game data path is set to './' by ScummVM
 		r = 2;


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