From 51b8dc9101c60fcce8531c3b03954d937a930a2e Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 21 Oct 2025 14:44:43 +0200 Subject: [PATCH] m_menu: add textinput special case for playername string itself it already checks to not write out of bounds, this is mostly just to fix visual issues kind hacky, but works for now --- src/m_menu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 3d8857b9a..86045dfcd 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -702,7 +702,13 @@ static void M_CheckStringItem(void) // Just in case memset(menu_text_input_buf, 0, sizeof menu_text_input_buf); - M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf); + + // special case: name input, cap it to prevent writing outside the textbox + // kinda ugly but itll work + if (cv == &cv_playername) + M_TextInputInit(&menuinput, menu_text_input_buf, MAXPLAYERNAME +1); + else + M_TextInputInit(&menuinput, menu_text_input_buf, sizeof menu_text_input_buf); M_TextInputSetString(&menuinput, cv->string); }