mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Fixed possible buffer overflow
This commit is contained in:
parent
d2e9571662
commit
c61522feba
@ -188,10 +188,8 @@ inp_get_char(char *input, int *size)
|
||||
|
||||
// otherwise just append
|
||||
} else {
|
||||
mbstate_t state;
|
||||
memset(&state, '\0', sizeof (state));
|
||||
char bytes[5];
|
||||
size_t utf_len = wcrtomb(bytes, ch, &state);
|
||||
char bytes[MB_CUR_MAX];
|
||||
size_t utf_len = wcrtomb(bytes, ch, NULL);
|
||||
int i;
|
||||
for (i = 0 ; i < utf_len; i++) {
|
||||
input[(*size)++] = bytes[i];
|
||||
|
Loading…
Reference in New Issue
Block a user