diff options
author | Jonathan Gray | 2002-09-15 09:06:58 +0000 |
---|---|---|
committer | Jonathan Gray | 2002-09-15 09:06:58 +0000 |
commit | 9ce78dd66e5b893bcfe8629ca1e880ab7c10682d (patch) | |
tree | 700264d2dbeabecaba599e55208fafe1c37e6c12 /gui/gui.cpp | |
parent | e6751d0d8f49e326ea7b1f6f506d1a9dfbd875db (diff) | |
download | scummvm-rg350-9ce78dd66e5b893bcfe8629ca1e880ab7c10682d.tar.gz scummvm-rg350-9ce78dd66e5b893bcfe8629ca1e880ab7c10682d.tar.bz2 scummvm-rg350-9ce78dd66e5b893bcfe8629ca1e880ab7c10682d.zip |
apply patch #609508 real fix for MI2 Dialog Box crash, by CCCP at Endy's request
svn-id: r4943
Diffstat (limited to 'gui/gui.cpp')
-rw-r--r-- | gui/gui.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/gui/gui.cpp b/gui/gui.cpp index 8d127226e2..96c74fd469 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -287,7 +287,6 @@ const GuiWidget pause_dialog[] = { {0, 0, 0, 0, 0, 0, 0, 0, 0} }; - void Gui::draw(int start, int end) { int i; @@ -419,8 +418,15 @@ void Gui::drawWidget(const GuiWidget *w) break; case GUI_RESTEXT: s = queryString(w->_string_number, w->_id); - if (s) - strcpy(text, s); + if (s) { + int t = resStrLen(s); + if (t >= 500) { // probably won't happen, but just in case... + warning("Resource string is too long, truncating"); + t = 498; + text[499] = '\0'; + } + memcpy(text, s, t+1); + } break; case GUI_VARTEXT: sprintf(text, "%s %d", string_map_table_custom[w->_string_number], @@ -907,8 +913,6 @@ void Gui::getSavegameNames(int start) const char *Gui::queryString(int stringno, int id) { - if ((stringno == 1) && (_s->_gameId == GID_MONKEY2)) return "How may I serve you?"; // FIXME (MI2 data file is wrong) - static char namebuf[64]; char *result; int string; |