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

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Mon Feb 1 00:28:12 CET 2010


Revision: 47785
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47785&view=rev
Author:   eriktorbjorn
Date:     2010-01-31 23:28:12 +0000 (Sun, 31 Jan 2010)

Log Message:
-----------
Silenced some more cppcheck warnings.

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

Modified: scummvm/trunk/engines/agi/predictive.cpp
===================================================================
--- scummvm/trunk/engines/agi/predictive.cpp	2010-01-31 22:38:07 UTC (rev 47784)
+++ scummvm/trunk/engines/agi/predictive.cpp	2010-01-31 23:28:12 UTC (rev 47785)
@@ -73,6 +73,7 @@
 	if (!str)
 		return;
 	strncpy(buf, str, MAXLINELEN);
+	buf[MAXLINELEN - 1] = 0;
 	char *word = strtok(buf, " ");
 	if (!word) {
 		debug("Invalid dictionary line");
@@ -415,6 +416,7 @@
 							_wordNumber = (_wordNumber + 1) % numMatchingWords;
 							char tmp[MAXLINELEN];
 							strncpy(tmp, _predictiveDictActLine, MAXLINELEN);
+							tmp[MAXLINELEN - 1] = 0;
 							char *tok = strtok(tmp, " ");
 							for (uint8 i = 0; i <= _wordNumber; i++)
 								tok = strtok(NULL, " ");
@@ -590,6 +592,7 @@
 		_predictiveDictActLine = _predictiveDictLine[line];
 		char tmp[MAXLINELEN];
 		strncpy(tmp, _predictiveDictActLine, MAXLINELEN);
+		tmp[MAXLINELEN - 1] = 0;
 		char *tok = strtok(tmp, " ");
 		tok = strtok(NULL, " ");
 		_currentWord = String(tok, _currentCode.size());

Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp	2010-01-31 22:38:07 UTC (rev 47784)
+++ scummvm/trunk/engines/scumm/detection.cpp	2010-01-31 23:28:12 UTC (rev 47785)
@@ -180,6 +180,7 @@
 		error("generateFilenameForDetection: Unsupported genMethod");
 	}
 
+	buf[sizeof(buf) - 1] = 0;
 	return buf;
 }
 


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