From 85a056f3824151e4f1838de2ca3aeb7e824c32b8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 18 Jul 2011 23:33:25 +0200 Subject: 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. --- engines/sci/engine/kstring.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/sci') 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; -- cgit v1.2.3