[Scummvm-cvs-logs] SF.net SVN: scummvm:[48093] scummvm/trunk/engines/cruise/background.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Feb 20 02:58:47 CET 2010
Revision: 48093
http://scummvm.svn.sourceforge.net/scummvm/?rev=48093&view=rev
Author: lordhoto
Date: 2010-02-20 01:58:46 +0000 (Sat, 20 Feb 2010)
Log Message:
-----------
strncpy does not always add a terminating zero, thus we need to do that on our own.
Modified Paths:
--------------
scummvm/trunk/engines/cruise/background.cpp
Modified: scummvm/trunk/engines/cruise/background.cpp
===================================================================
--- scummvm/trunk/engines/cruise/background.cpp 2010-02-20 01:57:34 UTC (rev 48092)
+++ scummvm/trunk/engines/cruise/background.cpp 2010-02-20 01:58:46 UTC (rev 48093)
@@ -211,10 +211,11 @@
MemFree(ptrToFree);
if (strcmp(name, backgroundTable[idx].name)) {
- if (strlen(name) > sizeof(backgroundTable[idx].name))
+ if (strlen(name) >= sizeof(backgroundTable[idx].name))
warning("background name length exceeded allowable maximum");
strncpy(backgroundTable[idx].name, name, sizeof(backgroundTable[idx].name));
+ backgroundTable[idx].name[sizeof(backgroundTable[idx].name) - 1] = 0;
}
return (0);
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