From c61522feba9ee45541e7896f6cf1fb16b0317b7f Mon Sep 17 00:00:00 2001 From: James Booth Date: Fri, 4 Jan 2013 01:06:42 +0000 Subject: Fixed possible buffer overflow --- src/input_win.c | 6 ++---- 1 file 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]; -- cgit 1.4.1-2-gfad0