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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Oct 11 19:07:53 CEST 2010


Revision: 53147
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53147&view=rev
Author:   lordhoto
Date:     2010-10-11 17:07:53 +0000 (Mon, 11 Oct 2010)

Log Message:
-----------
AGI: Fix possible buffer overflow.

This is based on patch #3085298 "overflows in agi and parallaction".

Modified Paths:
--------------
    scummvm/trunk/engines/agi/predictive.cpp

Modified: scummvm/trunk/engines/agi/predictive.cpp
===================================================================
--- scummvm/trunk/engines/agi/predictive.cpp	2010-10-11 17:07:34 UTC (rev 53146)
+++ scummvm/trunk/engines/agi/predictive.cpp	2010-10-11 17:07:53 UTC (rev 53147)
@@ -461,9 +461,8 @@
 	}
 
  press:
-	strncpy(_predictiveResult, prefix.c_str(), 40);
-	strncat(_predictiveResult, _currentWord.c_str(), 40);
-	_predictiveResult[prefix.size() + _currentCode.size() + 1] = 0;
+	Common::strlcpy(_predictiveResult, prefix.c_str(), sizeof(_predictiveResult));
+	Common::strlcat(_predictiveResult, _currentWord.c_str(), sizeof(_predictiveResult));
 
  getout:
 	// if another window was shown, bring it up again


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