aboutsummaryrefslogtreecommitdiff
path: root/engines
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
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')
-rw-r--r--engines/cruise/background.cpp8
-rw-r--r--engines/cruise/background.h2
2 files changed, 7 insertions, 3 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);
}
diff --git a/engines/cruise/background.h b/engines/cruise/background.h
index 6f9b89d3f0..caa90bea0f 100644
--- a/engines/cruise/background.h
+++ b/engines/cruise/background.h
@@ -29,7 +29,7 @@
namespace Cruise {
struct backgroundTableStruct {
- char name[9];
+ char name[16];
char extention[6];
};