diff options
author | James Booth <boothj5@gmail.com> | 2013-01-04 01:06:42 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-01-04 01:06:42 +0000 |
commit | c61522feba9ee45541e7896f6cf1fb16b0317b7f (patch) | |
tree | 939b53313b9f1baf32d44b2d11675d878f2aaf43 | |
parent | d2e957166263466a5225c0bdbc46a3dc8a6a3bf5 (diff) | |
download | profani-tty-c61522feba9ee45541e7896f6cf1fb16b0317b7f.tar.gz |
Fixed possible buffer overflow
-rw-r--r-- | src/input_win.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/input_win.c b/src/input_win.c index 87ceb7f1..7dddeba2 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -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]; |