aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-05-11 12:32:18 +0200
committerEugene Sandulenko2016-05-11 12:32:18 +0200
commita57aa559991dc47b0d3633b0a59ffff35358b236 (patch)
treebcc95d7d018ec411e83175d6f5944a14444a784c
parent775b615fdd786f67b3a784a8364f06afd7d71e97 (diff)
downloadscummvm-rg350-a57aa559991dc47b0d3633b0a59ffff35358b236.tar.gz
scummvm-rg350-a57aa559991dc47b0d3633b0a59ffff35358b236.tar.bz2
scummvm-rg350-a57aa559991dc47b0d3633b0a59ffff35358b236.zip
TINSEL: Safer string manipulation
-rw-r--r--engines/tinsel/bmv.cpp4
-rw-r--r--engines/tinsel/detection.cpp4
-rw-r--r--engines/tinsel/dialogs.cpp6
-rw-r--r--engines/tinsel/handle.cpp2
-rw-r--r--engines/tinsel/saveload.cpp2
5 files changed, 9 insertions, 9 deletions
diff --git a/engines/tinsel/bmv.cpp b/engines/tinsel/bmv.cpp
index 22c3798fc6..cfe97e6ec1 100644
--- a/engines/tinsel/bmv.cpp
+++ b/engines/tinsel/bmv.cpp
@@ -567,8 +567,8 @@ void BMVPlayer::PlayBMV(CORO_PARAM, SCNHANDLE hFileStem, int myEscape) {
assert(!bMovieOn);
- strcpy(szMovieFile, (char *)LockMem(hFileStem));
- strcat(szMovieFile, BMOVIE_EXTENSION);
+ Common::strlcpy(szMovieFile, (char *)LockMem(hFileStem), 14);
+ Common::strlcat(szMovieFile, BMOVIE_EXTENSION, 14);
assert(strlen(szMovieFile) <= 12);
diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index 2fde6e788a..c44f1f4ef3 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -235,7 +235,7 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const FileMap &allFile
for (fileDesc = g->desc.filesDescriptions; fileDesc->fileName; fileDesc++) {
// Get the next filename, stripping off any '1' suffix character
char tempFilename[50];
- strcpy(tempFilename, fileDesc->fileName);
+ Common::strlcpy(tempFilename, fileDesc->fileName, 50);
char *pOne = strchr(tempFilename, '1');
if (pOne) {
do {
@@ -275,7 +275,7 @@ const ADGameDescription *TinselMetaEngine::fallbackDetect(const FileMap &allFile
for (fileDesc = g->desc.filesDescriptions; fileDesc->fileName; fileDesc++) {
// Get the next filename, stripping off any '1' suffix character
char tempFilename[50];
- strcpy(tempFilename, fileDesc->fileName);
+ Common::strlcpy(tempFilename, fileDesc->fileName, 50);
char *pOne = strchr(tempFilename, '1');
if (pOne) {
do {
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index 4bc28ffb53..ad20253b9c 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -1671,10 +1671,10 @@ static void Select(int i, bool force) {
#else
// Current description with cursor appended
if (cd.box[i].boxText != NULL) {
- strcpy(g_sedit, cd.box[i].boxText);
- strcat(g_sedit, sCursor);
+ Common::strlcpy(g_sedit, cd.box[i].boxText, SG_DESC_LEN+2);
+ Common::strlcat(g_sedit, sCursor, SG_DESC_LEN+2);
} else {
- strcpy(g_sedit, sCursor);
+ Common::strlcpy(g_sedit, sCursor, SG_DESC_LEN+2);
}
#endif
diff --git a/engines/tinsel/handle.cpp b/engines/tinsel/handle.cpp
index 62d244e449..9ffd477c4a 100644
--- a/engines/tinsel/handle.cpp
+++ b/engines/tinsel/handle.cpp
@@ -258,7 +258,7 @@ void LoadExtraGraphData(SCNHANDLE start, SCNHANDLE next) {
}
void SetCdPlaySceneDetails(int fileNum, const char *fileName) {
- strcpy(g_szCdPlayFile, fileName);
+ Common::strlcpy(g_szCdPlayFile, fileName, 100);
}
void SetCdPlayHandle(int fileNum) {
diff --git a/engines/tinsel/saveload.cpp b/engines/tinsel/saveload.cpp
index 88cd80b78a..226cbb51c0 100644
--- a/engines/tinsel/saveload.cpp
+++ b/engines/tinsel/saveload.cpp
@@ -563,7 +563,7 @@ static void DoSave() {
while (1) {
Common::String fname = _vm->getSavegameFilename(ano);
- strcpy(tmpName, fname.c_str());
+ Common::strlcpy(tmpName, fname.c_str(), FNAMELEN);
for (i = 0; i < g_numSfiles; i++)
if (!strcmp(g_savedFiles[i].name, tmpName))