diff options
author | Johannes Schickel | 2008-11-15 03:16:41 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-11-15 03:16:41 +0000 |
commit | 478ee06fb818a5d22a8d20b38cca5052e2a5b947 (patch) | |
tree | bdfe00583470a411a668b461a57ff891a35128ab /engines/scumm | |
parent | 486523af51575240a633cec6e62bd498119b6f53 (diff) | |
download | scummvm-rg350-478ee06fb818a5d22a8d20b38cca5052e2a5b947.tar.gz scummvm-rg350-478ee06fb818a5d22a8d20b38cca5052e2a5b947.tar.bz2 scummvm-rg350-478ee06fb818a5d22a8d20b38cca5052e2a5b947.zip |
Paranoia: Add destination buffer size to Engine::errorString to help avoiding buffer overflows.
svn-id: r35072
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/scumm.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 2 |
2 files changed, 3 insertions, 3 deletions
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(); |