aboutsummaryrefslogtreecommitdiff
path: root/engines/cruise/background.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2010-02-19 22:26:30 +0000
committerPaul Gilbert2010-02-19 22:26:30 +0000
commitb51568ddaf96f77c7993afe44e801193b38f0cb4 (patch)
tree16367d8222f264981bd82cc367b9827a18d6e05e /engines/cruise/background.cpp
parentb3bfe83877c27e0df3566041584a737388685fb6 (diff)
downloadscummvm-rg350-b51568ddaf96f77c7993afe44e801193b38f0cb4.tar.gz
scummvm-rg350-b51568ddaf96f77c7993afe44e801193b38f0cb4.tar.bz2
scummvm-rg350-b51568ddaf96f77c7993afe44e801193b38f0cb4.zip
Increased the amount of space for storing background filenames to fix memory overflow
svn-id: r48091
Diffstat (limited to 'engines/cruise/background.cpp')
-rw-r--r--engines/cruise/background.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp
index e8f0865270..a32973eb54 100644
--- a/engines/cruise/background.cpp
+++ b/engines/cruise/background.cpp
@@ -210,8 +210,12 @@ int loadBackground(const char *name, int idx) {
MemFree(ptrToFree);
- if (name != backgroundTable[idx].name)
- strcpy(backgroundTable[idx].name, name);
+ if (name != 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));
+ }
return (0);
}