From 41314a356177eaa06a2bc67401e9733a965bd4b8 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 20 Feb 2010 01:58:46 +0000 Subject: strncpy does not always add a terminating zero, thus we need to do that on our own. svn-id: r48093 --- engines/cruise/background.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3