ILLUSIONS: Fix static buffer overrun in debug log function.
This was causing the game to crash when loading the main scumm menu. It was corrupting another static string in the about dialog.
This commit is contained in:
parent
9be0a7b085
commit
39798c63d1
5 changed files with 15 additions and 33 deletions
|
@ -61,6 +61,19 @@
|
|||
|
||||
namespace Illusions {
|
||||
|
||||
char *debugW2I(byte *wstr) {
|
||||
static char buf[65];
|
||||
char *p = buf;
|
||||
int i = 0;
|
||||
while (*wstr != 0 && i < sizeof(buf) - 1) {
|
||||
*p++ = *wstr;
|
||||
wstr += 2;
|
||||
i++;
|
||||
}
|
||||
*p = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
IllusionsEngine::IllusionsEngine(OSystem *syst, const IllusionsGameDescription *gd) :
|
||||
Engine(syst), _gameDescription(gd) {
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ struct ADGameDescription;
|
|||
|
||||
namespace Illusions {
|
||||
|
||||
char *debugW2I(byte *wstr);
|
||||
|
||||
#define ILLUSIONS_SAVEGAME_VERSION 0
|
||||
|
||||
class ResourceSystem;
|
||||
|
|
|
@ -217,17 +217,6 @@ SceneInfo::~SceneInfo() {
|
|||
delete[] _resources;
|
||||
}
|
||||
|
||||
char *debugW2I(byte *wstr) {
|
||||
static char buf[65];
|
||||
char *p = buf;
|
||||
while (*wstr != 0) {
|
||||
*p++ = *wstr;
|
||||
wstr += 2;
|
||||
}
|
||||
*p = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
void SceneInfo::load(byte *dataStart, Common::SeekableReadStream &stream) {
|
||||
_id = stream.readUint16LE();
|
||||
_unk = stream.readUint16LE();
|
||||
|
|
|
@ -285,17 +285,6 @@ void TalkThread::refreshText() {
|
|||
_textEndTime = _textStartTime + _textDuration;
|
||||
}
|
||||
|
||||
static char *debugW2I(byte *wstr) {
|
||||
static char buf[65];
|
||||
char *p = buf;
|
||||
while (*wstr != 0) {
|
||||
*p++ = *wstr;
|
||||
wstr += 2;
|
||||
}
|
||||
*p = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
int TalkThread::insertText() {
|
||||
debug("%08X %08X [%s]", _threadId, _talkId, debugW2I(_currEntryText));
|
||||
WidthHeight dimensions;
|
||||
|
|
|
@ -293,17 +293,6 @@ void TalkThread_Duckman::refreshText() {
|
|||
_textEndTime = _textStartTime + _textDuration;
|
||||
}
|
||||
|
||||
static char *debugW2I(byte *wstr) {
|
||||
static char buf[65];
|
||||
char *p = buf;
|
||||
while (*wstr != 0) {
|
||||
*p++ = *wstr;
|
||||
wstr += 2;
|
||||
}
|
||||
*p = 0;
|
||||
return buf;
|
||||
}
|
||||
|
||||
int TalkThread_Duckman::insertText() {
|
||||
debug(0, "%08X %08X [%s]", _threadId, _talkId, debugW2I(_currEntryText));
|
||||
WidthHeight dimensions;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue