From 96cb2ae945c9c3e69f31ce4b99c1fc99b96ab2e1 Mon Sep 17 00:00:00 2001 From: Liu Yi Date: Mon, 2 Sep 2024 11:48:07 +0800 Subject: [PATCH] fix(ime): fix ime crash when input_char is too long (#6767) Signed-off-by: lhdjply --- src/others/ime/lv_ime_pinyin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/others/ime/lv_ime_pinyin.c b/src/others/ime/lv_ime_pinyin.c index b763be443..8382269b7 100644 --- a/src/others/ime/lv_ime_pinyin.c +++ b/src/others/ime/lv_ime_pinyin.c @@ -707,7 +707,8 @@ static void lv_ime_pinyin_kb_event(lv_event_t * e) } else if((pinyin_ime->mode == LV_IME_PINYIN_MODE_K26) && ((txt[0] >= 'a' && txt[0] <= 'z') || (txt[0] >= 'A' && txt[0] <= 'Z'))) { - lv_strcat(pinyin_ime->input_char, txt); + uint16_t len = lv_strlen(pinyin_ime->input_char); + lv_snprintf(pinyin_ime->input_char + len, sizeof(pinyin_ime->input_char) - len, "%s", txt); pinyin_input_proc(obj); pinyin_ime->ta_count++; }