From f5276234050cfc4d546bfe4158185d265e21039a Mon Sep 17 00:00:00 2001 From: Fenrir Date: Wed, 14 Feb 2024 13:47:11 -0700 Subject: [PATCH] Fix off-by-one error in swkbd_message_callback --- ctru-rs/src/applets/swkbd.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ctru-rs/src/applets/swkbd.rs b/ctru-rs/src/applets/swkbd.rs index c1a6740..fa0f45d 100644 --- a/ctru-rs/src/applets/swkbd.rs +++ b/ctru-rs/src/applets/swkbd.rs @@ -890,7 +890,11 @@ impl SoftwareKeyboard { let callback_msg = &mut swkbd.callback_msg; if swkbd.callback_result > SWKBD_CALLBACK_OK as _ { - for (idx, ch) in retmsg.encode_utf16().take(callback_msg.len()).enumerate() { + for (idx, ch) in retmsg + .encode_utf16() + .take(callback_msg.len() - 1) + .enumerate() + { callback_msg[idx] = ch; } } else {