# HG changeset patch # User rubidium42 # Date 2021-06-04 16:59:13 # Node ID d899972faf30f26f6a90ecd6653da25114314342 # Parent e2ce1a56efedd515466030b271c576675cfb49e9 Fix: [Script] Ensure the saved script strings are properly validated and terminated when being read from the savegame diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp --- a/src/script/script_instance.cpp +++ b/src/script/script_instance.cpp @@ -569,8 +569,9 @@ bool ScriptInstance::IsPaused() case SQSL_STRING: { SlObject(nullptr, _script_byte); - static char buf[256]; + static char buf[std::numeric_limits::max()]; SlArray(buf, _script_sl_byte, SLE_CHAR); + StrMakeValidInPlace(buf, buf + _script_sl_byte); if (vm != nullptr) sq_pushstring(vm, buf, -1); return true; }