diff options
author | Colin Snover | 2016-11-04 15:00:09 -0500 |
---|---|---|
committer | Colin Snover | 2016-11-04 15:16:10 -0500 |
commit | 5a5945cbbb37fb63f8bc592a30d91bad311bd554 (patch) | |
tree | e584d2c850b6d0f0579323bc9a6d23b1bf1b3a3b /engines/sci/engine/kstring.cpp | |
parent | 44dfa4c49fef7c6d3e92b8f1fc45259404ec56ee (diff) | |
download | scummvm-rg350-5a5945cbbb37fb63f8bc592a30d91bad311bd554.tar.gz scummvm-rg350-5a5945cbbb37fb63f8bc592a30d91bad311bd554.tar.bz2 scummvm-rg350-5a5945cbbb37fb63f8bc592a30d91bad311bd554.zip |
SCI32: Allow format strings with missing arguments
SSCI created a fake va_list and passed it to vsprintf, so extra
placeholders would just silently end up reading garbage memory.
Diffstat (limited to 'engines/sci/engine/kstring.cpp')
-rw-r--r-- | engines/sci/engine/kstring.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index bfabbcc90e..74c1f99778 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -806,8 +806,11 @@ Common::String format(const Common::String &source, int argc, const reg_t *argv) continue; } - assert(argIndex < argc); - out += readPlaceholder(in, argv[argIndex++]); + if (argIndex < argc) { + out += readPlaceholder(in, argv[argIndex++]); + } else { + out += readPlaceholder(in, NULL_REG); + } } else { out += *in++; } |