mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 03:46:22 +00:00
Fixed possible buffer overflow
This commit is contained in:
@@ -188,10 +188,8 @@ inp_get_char(char *input, int *size)
|
|||||||
|
|
||||||
// otherwise just append
|
// otherwise just append
|
||||||
} else {
|
} else {
|
||||||
mbstate_t state;
|
char bytes[MB_CUR_MAX];
|
||||||
memset(&state, '\0', sizeof (state));
|
size_t utf_len = wcrtomb(bytes, ch, NULL);
|
||||||
char bytes[5];
|
|
||||||
size_t utf_len = wcrtomb(bytes, ch, &state);
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0 ; i < utf_len; i++) {
|
for (i = 0 ; i < utf_len; i++) {
|
||||||
input[(*size)++] = bytes[i];
|
input[(*size)++] = bytes[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user