Fix possible buffer overflow in M_TextInputSetString when string length is greatter than buffer length

This commit is contained in:
indev committed 2025-10-21 01:46:39 +03:00
1 parent 4a786449c4
commit b99cd88947
1 file changed
+2 -2
+2 -2
View File
@@ -239,8 +239,8 @@ void M_TextInputClear(textinput_t *input)
void M_TextInputSetString(textinput_t *input, const char *c)
{
memset(input->buffer, 0, input->buffer_size);
strcpy(input->buffer, c);
input->cursor = input->select = input->length = strlen(c);
strncpy(input->buffer, c, input->buffer_size);
input->cursor = input->select = input->length = strlen(input->buffer);
}
static boolean M_TextInputHandleBase(textinput_t *input, INT32 key, boolean emotes)