From d7cc97433d332b5cff7a6d1d829ff5f8970157a4 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 12 Jan 2019 12:00:50 +0100 Subject: [PATCH] cellOskDialogUnloadAsync: guarantee 0 terminated return string --- rpcs3/Emu/Cell/Modules/cellOskDialog.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index 03647089e3..70a61ff9ed 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -238,13 +238,21 @@ error_code getText(vm::ptr OutputInfo, bool is { osk->osk_text_old[i] = osk->osk_text[i]; - if (do_copy && i < OutputInfo->numCharsResultString) + if (do_copy) { - if (osk->osk_text[i] == 0) + if (i < OutputInfo->numCharsResultString) { + if (osk->osk_text[i] == 0) + { + do_copy = false; + } + OutputInfo->pResultString[i] = osk->osk_text[i]; + } + else + { + OutputInfo->pResultString[i] = 0; do_copy = false; } - OutputInfo->pResultString[i] = osk->osk_text[i]; } }