From db7496a37c42dfb2422c5ffe7c39375934bb0419 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 11 Sep 2013 08:04:01 -0700 Subject: [PATCH] Write only changed characters from OSK. --- Core/Dialog/PSPOskDialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index 73dbabcbf1..b6616c4c42 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -945,7 +945,11 @@ int PSPOskDialog::Update() } u16_le *outText = oskParams->fields[0].outtext; - for (u32 i = 0, end = oskParams->fields[0].outtextlength; i < end; ++i) + size_t end = oskParams->fields[0].outtextlength; + // Only write the bytes of the output and the null terminator, don't write the rest. + if (end > inputChars.size()) + end = inputChars.size() + 1; + for (size_t i = 0; i < end; ++i) { u16 value = 0; if (i < inputChars.size())