aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle
diff options
context:
space:
mode:
authorStrangerke2013-07-19 17:54:09 +0200
committerStrangerke2013-07-19 17:54:09 +0200
commit4c3b2d3f544f22c6f2404d5a25cfc23dee1d75af (patch)
treef173c4b163064844efce1d5559dca9d7cd962d4a /engines/mortevielle
parent3d64ccac9c4cfbf477eb3e03273faa255d0bb6d3 (diff)
downloadscummvm-rg350-4c3b2d3f544f22c6f2404d5a25cfc23dee1d75af.tar.gz
scummvm-rg350-4c3b2d3f544f22c6f2404d5a25cfc23dee1d75af.tar.bz2
scummvm-rg350-4c3b2d3f544f22c6f2404d5a25cfc23dee1d75af.zip
MORTEVIELLE: Add a safeguard in Copy()
Diffstat (limited to 'engines/mortevielle')
-rw-r--r--engines/mortevielle/utils.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp
index 2c1a501b19..28f3e4f629 100644
--- a/engines/mortevielle/utils.cpp
+++ b/engines/mortevielle/utils.cpp
@@ -2487,6 +2487,8 @@ void MortevielleEngine::palette(int v1) {
*/
Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t size) {
+ assert(idx + size < s.size());
+
// Copy the substring into a temporary buffer
char *tmp = new char[size + 1];
strncpy(tmp, s.c_str() + idx - 1, size);