aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2011-07-18 23:33:25 +0200
committerWillem Jan Palenstijn2011-07-18 23:36:56 +0200
commit85a056f3824151e4f1838de2ca3aeb7e824c32b8 (patch)
tree67e22fd9fe70813cd27acfcbed8c5cea675a9d61 /engines
parenta49d07d95f4602b5e4b8d83b9c0e1887810c5a85 (diff)
downloadscummvm-rg350-85a056f3824151e4f1838de2ca3aeb7e824c32b8.tar.gz
scummvm-rg350-85a056f3824151e4f1838de2ca3aeb7e824c32b8.tar.bz2
scummvm-rg350-85a056f3824151e4f1838de2ca3aeb7e824c32b8.zip
SCI: Fix kFormat's handling of %c with a 0 argument
SSCI used a sprintf to handle %c, appending the result to the output, which is effectively a nop for a zero argument. This is bug #3368821. Thanks to digitall for tracing it to KFormat and testing this patch.
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kstring.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 7b8db22e3f..b383f88840 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -336,8 +336,9 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
if (align >= 0)
while (str_leng-- > 1)
*target++ = ' '; /* Format into the text */
-
- *target++ = arguments[paramindex++];
+ char argchar = arguments[paramindex++];
+ if (argchar)
+ *target++ = argchar;
mode = 0;
}
break;