aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/gameDetector.cpp6
-rw-r--r--common/scummsys.h1
-rw-r--r--scumm/script_v2.cpp2
3 files changed, 6 insertions, 3 deletions
diff --git a/common/gameDetector.cpp b/common/gameDetector.cpp
index 237dbf663f..94e46da0dc 100644
--- a/common/gameDetector.cpp
+++ b/common/gameDetector.cpp
@@ -548,8 +548,10 @@ int GameDetector::detectMain(int argc, char **argv)
&& _gameDataPath[strlen(_gameDataPath)-1] != '\\') {
char slashless[1024]; /* Append slash to path */
strcpy(slashless, _gameDataPath);
- _gameDataPath = (char *)malloc((strlen(slashless) + 1) * sizeof(char));
- sprintf(_gameDataPath, "%s/", slashless);
+
+ // need to allocate 2 extra bytes, one for the "/" and one for the NULL terminator
+ _gameDataPath = (char *)malloc((strlen(slashless) + 2) * sizeof(char));
+ snprintf(_gameDataPath, strlen(_gameDataPath), "%s/", slashless);
}
if (_amiga)
diff --git a/common/scummsys.h b/common/scummsys.h
index 5234c1ceaf..9048a1e3d2 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -34,6 +34,7 @@ const bool true(1), false(0);
//#pragma warning (disable: 4101)
#define scumm_stricmp stricmp
+#define snprintf _snprintf
#if defined(CHECK_HEAP)
#undef CHECK_HEAP
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index a717980013..9117bf62cb 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -2973,7 +2973,7 @@ void Scumm::o6_kernelFunction()
push(a->frame);
break;
case 215:
- if (_extraBoxFlags[args[1]] & 0x00FF == 0x00C0) {
+ if ((_extraBoxFlags[args[1]] & 0x00FF) == 0x00C0) {
push(_extraBoxFlags[args[1]]);
} else {
byte *temp = (byte *)getBoxBaseAddr(args[1]);