From 39798c63d1d6a7153527a726acfa3c1cf837760f Mon Sep 17 00:00:00 2001 From: Eric Fry Date: Mon, 30 Apr 2018 18:25:49 +1000 Subject: 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. --- engines/illusions/illusions.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'engines/illusions/illusions.cpp') diff --git a/engines/illusions/illusions.cpp b/engines/illusions/illusions.cpp index 9224ba9139..7b2f5f9b04 100644 --- a/engines/illusions/illusions.cpp +++ b/engines/illusions/illusions.cpp @@ -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) { -- cgit v1.2.3