From f833ace5ca92baae6849064e519062b8da192b5f Mon Sep 17 00:00:00 2001 From: marco <49691247+marcoSchr@users.noreply.github.com> Date: Wed, 29 May 2024 22:00:14 +0200 Subject: [PATCH] UI: fixed issue with overflowing text input buffer --- openrtx/src/ui/default/ui.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openrtx/src/ui/default/ui.c b/openrtx/src/ui/default/ui.c index b7a18367..8b8afecf 100644 --- a/openrtx/src/ui/default/ui.c +++ b/openrtx/src/ui/default/ui.c @@ -1106,7 +1106,8 @@ static void _ui_textInputKeypad(char *buf, uint8_t max_len, kbd_msg_t msg, else num_symbols = strlen(symbols_ITU_T_E161[num_key]); - if((ui_state.input_position > max_len) || ((ui_state.input_position == max_len) && (key_timeout || !same_key))) + // Return if max length is reached or finished editing last character + if((ui_state.input_position >= max_len) || ((ui_state.input_position == (max_len-1)) && (key_timeout || !same_key))) return; // Skip keypad logic for first keypress