diff options
author | Strangerke | 2014-05-31 01:24:28 +0200 |
---|---|---|
committer | Strangerke | 2014-05-31 01:35:32 +0200 |
commit | 8cbee1509606986584625c669fc992f084036b76 (patch) | |
tree | fd09b6cc8c6f168ff4ab0bfa5479eb576f1b282b | |
parent | 3e9c1ea50a401ac27cbf0ea442d4e72c8087f902 (diff) | |
download | scummvm-rg350-8cbee1509606986584625c669fc992f084036b76.tar.gz scummvm-rg350-8cbee1509606986584625c669fc992f084036b76.tar.bz2 scummvm-rg350-8cbee1509606986584625c669fc992f084036b76.zip |
CRUISE: Add safeguards to avoid a buffer overflow in linker and sound
-rw-r--r-- | engines/cruise/linker.cpp | 4 | ||||
-rw-r--r-- | engines/cruise/sound.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/engines/cruise/linker.cpp b/engines/cruise/linker.cpp index 817345d06e..cb750b0ed2 100644 --- a/engines/cruise/linker.cpp +++ b/engines/cruise/linker.cpp @@ -165,7 +165,7 @@ int updateScriptImport(int ovlIdx) { int out1; int out2; - strcpy(buffer, ptrImportName + ptrImportData->offsetToName); + Common::strlcpy(buffer, ptrImportName + ptrImportData->offsetToName, sizeof(buffer)); ptrDest2 = parseExport(&out1, &out2, buffer); if (ptrDest2 && out2) { @@ -230,7 +230,7 @@ int updateScriptImport(int ovlIdx) { int linkType; int linkEntryIdx; - strcpy(buffer, ovlData->arrayNameRelocGlob + ovlData->arrayRelocGlob[i].nameOffset); + Common::strlcpy(buffer, ovlData->arrayNameRelocGlob + ovlData->arrayRelocGlob[i].nameOffset, sizeof(buffer)); pFoundExport = parseExport(&out1, &foundExportIdx, buffer); diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp index 86146e3189..1441ae9661 100644 --- a/engines/cruise/sound.cpp +++ b/engines/cruise/sound.cpp @@ -630,7 +630,7 @@ bool PCSoundFxPlayer::load(const char *song) { stop(); } - strcpy(_musicName, song); + Common::strlcpy(_musicName, song, sizeof(_musicName)); _songPlayed = false; _looping = false; _sfxData = readBundleSoundFile(song); @@ -652,7 +652,7 @@ bool PCSoundFxPlayer::load(const char *song) { if (dot) { *dot = '\0'; } - strcat(instrument, _driver->getInstrumentExtension()); + Common::strlcat(instrument, _driver->getInstrumentExtension(), sizeof(instrument)); _instrumentsData[i] = readBundleSoundFile(instrument); if (!_instrumentsData[i]) { warning("Unable to load soundfx instrument '%s'", instrument); |