aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2010-02-20 01:58:46 +0000
committerJohannes Schickel2010-02-20 01:58:46 +0000
commit41314a356177eaa06a2bc67401e9733a965bd4b8 (patch)
tree1cf22b43ef076ce4291a6ce1c45fe0b1d61b3622 /engines
parent9b467ee4ff927b8cad22ce1afb538b6b5a46c6fc (diff)
downloadscummvm-rg350-41314a356177eaa06a2bc67401e9733a965bd4b8.tar.gz
scummvm-rg350-41314a356177eaa06a2bc67401e9733a965bd4b8.tar.bz2
scummvm-rg350-41314a356177eaa06a2bc67401e9733a965bd4b8.zip
strncpy does not always add a terminating zero, thus we need to do that on our own.
svn-id: r48093
Diffstat (limited to 'engines')
-rw-r--r--engines/cruise/background.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp
index 38fdd0dc9e..c6229beccc 100644
--- a/engines/cruise/background.cpp
+++ b/engines/cruise/background.cpp
@@ -211,10 +211,11 @@ int loadBackground(const char *name, int idx) {
MemFree(ptrToFree);
if (strcmp(name, backgroundTable[idx].name)) {
- if (strlen(name) > sizeof(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));
+ backgroundTable[idx].name[sizeof(backgroundTable[idx].name) - 1] = 0;
}
return (0);