summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-08-05 04:32:09 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-08-05 04:32:09 +0200
commitf10dc35dd0d23475b65e7c3830eb13f3cad45a89 (patch)
tree97bdcc3860510112b7bf6031545067fbfc4b52ac /src/core/hle
parentnvdec: Implement VA-API hardware video acceleration (#6713) (diff)
downloadyuzu-f10dc35dd0d23475b65e7c3830eb13f3cad45a89.tar
yuzu-f10dc35dd0d23475b65e7c3830eb13f3cad45a89.tar.gz
yuzu-f10dc35dd0d23475b65e7c3830eb13f3cad45a89.tar.bz2
yuzu-f10dc35dd0d23475b65e7c3830eb13f3cad45a89.tar.lz
yuzu-f10dc35dd0d23475b65e7c3830eb13f3cad45a89.tar.xz
yuzu-f10dc35dd0d23475b65e7c3830eb13f3cad45a89.tar.zst
yuzu-f10dc35dd0d23475b65e7c3830eb13f3cad45a89.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/am/applets/applet_software_keyboard.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/hle/service/am/applets/applet_software_keyboard.cpp b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
index 673abb755..c89aa1bbf 100644
--- a/src/core/hle/service/am/applets/applet_software_keyboard.cpp
+++ b/src/core/hle/service/am/applets/applet_software_keyboard.cpp
@@ -377,7 +377,8 @@ void SoftwareKeyboard::SubmitForTextCheck(std::u16string submitted_text) {
if (swkbd_config_common.use_utf8) {
std::string utf8_submitted_text = Common::UTF16ToUTF8(current_text);
- const u64 buffer_size = utf8_submitted_text.size();
+ // Include the null terminator in the buffer size.
+ const u64 buffer_size = utf8_submitted_text.size() + 1;
LOG_DEBUG(Service_AM, "\nBuffer Size: {}\nUTF-8 Submitted Text: {}", buffer_size,
utf8_submitted_text);
@@ -386,7 +387,8 @@ void SoftwareKeyboard::SubmitForTextCheck(std::u16string submitted_text) {
std::memcpy(out_data.data() + sizeof(u64), utf8_submitted_text.data(),
utf8_submitted_text.size());
} else {
- const u64 buffer_size = current_text.size() * sizeof(char16_t);
+ // Include the null terminator in the buffer size.
+ const u64 buffer_size = (current_text.size() + 1) * sizeof(char16_t);
LOG_DEBUG(Service_AM, "\nBuffer Size: {}\nUTF-16 Submitted Text: {}", buffer_size,
Common::UTF16ToUTF8(current_text));