diff options
-rw-r--r-- | engines/cruise/background.cpp | 3 | ||||
-rw-r--r-- | engines/cruise/function.cpp | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp index 3ac57cc376..edd52d3b4a 100644 --- a/engines/cruise/background.cpp +++ b/engines/cruise/background.cpp @@ -216,8 +216,7 @@ int loadBackground(const char *name, int idx) { 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; + Common::strlcpy(backgroundTable[idx].name, name, sizeof(backgroundTable[idx].name)); } return (0); diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index 7c8f8af942..c3d435bde6 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -58,7 +58,7 @@ int16 Op_LoadOverlay() { updateAllScriptsImports(); - strncpy(nextOverlay, overlayName, 38); + Common::strlcpy(nextOverlay, overlayName, sizeof(nextOverlay)); return overlayLoadResult; } |