[Scummvm-cvs-logs] SF.net SVN: scummvm:[47479] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Jan 23 17:15:19 CET 2010
Revision: 47479
http://scummvm.svn.sourceforge.net/scummvm/?rev=47479&view=rev
Author: lordhoto
Date: 2010-01-23 16:15:18 +0000 (Sat, 23 Jan 2010)
Log Message:
-----------
Paranoia change: add some explicit terminating 0 after some strncpy uses.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/gui_lok.cpp
scummvm/trunk/engines/kyra/kyra_mr.cpp
scummvm/trunk/engines/kyra/sequences_lol.cpp
scummvm/trunk/engines/kyra/sound_digital.cpp
scummvm/trunk/engines/kyra/text_lok.cpp
scummvm/trunk/engines/kyra/text_mr.cpp
Modified: scummvm/trunk/engines/kyra/gui_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lok.cpp 2010-01-23 15:27:47 UTC (rev 47478)
+++ scummvm/trunk/engines/kyra/gui_lok.cpp 2010-01-23 16:15:18 UTC (rev 47479)
@@ -749,6 +749,7 @@
for (int i = 0; i < 5; i++) {
if (_menu[2].item[i].saveSlot == _vm->_gameToLoad) {
strncpy(_savegameName, _menu[2].item[i].itemString, 31);
+ _savegameName[30] = 0;
break;
}
}
@@ -757,7 +758,7 @@
_screen->setFont(cf);
- while (_displaySubMenu && !_vm->shouldQuit()) {
+ while (_displaySubMenu && !_vm->shouldQuit()) {
checkTextfieldInput();
cf = _screen->setFont(Screen::FID_8_FNT);
updateSavegameString();
Modified: scummvm/trunk/engines/kyra/kyra_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.cpp 2010-01-23 15:27:47 UTC (rev 47478)
+++ scummvm/trunk/engines/kyra/kyra_mr.cpp 2010-01-23 16:15:18 UTC (rev 47479)
@@ -1319,6 +1319,7 @@
uint32 size = 0;
char nBuf[32];
strncpy(nBuf, file, 32);
+ nBuf[31] = 0;
buffer = _res->fileData(appendLanguage(nBuf, _lang, sizeof(nBuf)), &size);
return buffer ? size : 0 ;
Modified: scummvm/trunk/engines/kyra/sequences_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sequences_lol.cpp 2010-01-23 15:27:47 UTC (rev 47478)
+++ scummvm/trunk/engines/kyra/sequences_lol.cpp 2010-01-23 16:15:18 UTC (rev 47479)
@@ -772,7 +772,7 @@
char tempWsaFilename[16];
char voiceFilename[13];
// the 'a' *has* to be lowercase
- strncpy(voiceFilename, "PS_1a", sizeof(voiceFilename));
+ strcpy(voiceFilename, "PS_1a");
int part = 0;
Sound *sound = _vm->sound();
Modified: scummvm/trunk/engines/kyra/sound_digital.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_digital.cpp 2010-01-23 15:27:47 UTC (rev 47478)
+++ scummvm/trunk/engines/kyra/sound_digital.cpp 2010-01-23 16:15:18 UTC (rev 47479)
@@ -459,6 +459,7 @@
}
strncpy(use->filename, filename, sizeof(use->filename));
+ use->filename[sizeof(use->filename) - 1] = 0;
use->priority = priority;
Audio::SeekableAudioStream *audioStream = _supportedCodecs[usedCodec].streamFunc(stream, DisposeAfterUse::YES);
if (!audioStream) {
Modified: scummvm/trunk/engines/kyra/text_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_lok.cpp 2010-01-23 15:27:47 UTC (rev 47478)
+++ scummvm/trunk/engines/kyra/text_lok.cpp 2010-01-23 16:15:18 UTC (rev 47479)
@@ -349,6 +349,7 @@
void KyraEngine_LoK::updateSentenceCommand(const char *str1, const char *str2, int color) {
char sentenceCommand[500];
strncpy(sentenceCommand, str1, 500);
+ sentenceCommand[499] = 0;
if (str2)
strncat(sentenceCommand, str2, 500 - strlen(sentenceCommand));
Modified: scummvm/trunk/engines/kyra/text_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/text_mr.cpp 2010-01-23 15:27:47 UTC (rev 47478)
+++ scummvm/trunk/engines/kyra/text_mr.cpp 2010-01-23 16:15:18 UTC (rev 47479)
@@ -34,8 +34,10 @@
}
char *TextDisplayer_MR::preprocessString(const char *str) {
- if (_talkBuffer != str)
- strncpy(_talkBuffer, str, sizeof(_talkBuffer));
+ if (_talkBuffer != str) {
+ assert(strlen(str) < sizeof(_talkBuffer) - 1);
+ strcpy(_talkBuffer, str);
+ }
char *p = _talkBuffer;
while (*p) {
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