diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/engine.cpp | 4 | ||||
-rw-r--r-- | engines/engine.h | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/engines/engine.cpp b/engines/engine.cpp index dcdcbd1d32..2c9835acc5 100644 --- a/engines/engine.cpp +++ b/engines/engine.cpp @@ -251,8 +251,8 @@ bool Engine::shouldPerformAutoSave(int lastSaveTime) { return autosavePeriod != 0 && diff > autosavePeriod * 1000; } -void Engine::errorString(const char *buf1, char *buf2) { - strcpy(buf2, buf1); +void Engine::errorString(const char *buf1, char *buf2, int size) { + strncpy(buf2, buf1, size); } void Engine::pauseEngine(bool pause) { diff --git a/engines/engine.h b/engines/engine.h index 4e16f01335..de8523a1b0 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -154,7 +154,7 @@ public: /** * Prepare an error string, which is printed by the error() function. */ - virtual void errorString(const char *buf_input, char *buf_output); + virtual void errorString(const char *buf_input, char *buf_output, int buf_output_size); /** * Return the engine's debugger instance, if any. Used by error() to diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 0869a3dff6..93605fa29b 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -2338,9 +2338,9 @@ GUI::Debugger *ScummEngine::getDebugger() { return _debugger; } -void ScummEngine::errorString(const char *buf1, char *buf2) { +void ScummEngine::errorString(const char *buf1, char *buf2, int buf2Size) { if (_currentScript != 0xFF) { - sprintf(buf2, "(%d:%d:0x%lX): %s", _roomResource, + snprintf(buf2, buf2Size, "(%d:%d:0x%lX): %s", _roomResource, vm.slot[_currentScript].number, (long)(_scriptPointer - _scriptOrgPointer), buf1); } else { strcpy(buf2, buf1); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 1c550f824c..c4697ecbe4 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -445,7 +445,7 @@ public: // Engine APIs virtual Common::Error init(); virtual Common::Error go(); - virtual void errorString(const char *buf_input, char *buf_output); + virtual void errorString(const char *buf_input, char *buf_output, int buf_output_size); virtual GUI::Debugger *getDebugger(); virtual bool hasFeature(EngineFeature f) const; virtual void syncSoundSettings(); |