Fix possible buffer overflow in M_TextInputSetString when string length is greatter than buffer length
This commit is contained in:
parent
1a33deff34
commit
3c7b01cd93
1 changed files with 2 additions and 2 deletions
|
|
@ -228,8 +228,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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue