about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-04 01:06:42 +0000
committerJames Booth <boothj5@gmail.com>2013-01-04 01:06:42 +0000
commitc61522feba9ee45541e7896f6cf1fb16b0317b7f (patch)
tree939b53313b9f1baf32d44b2d11675d878f2aaf43
parentd2e957166263466a5225c0bdbc46a3dc8a6a3bf5 (diff)
downloadprofani-tty-c61522feba9ee45541e7896f6cf1fb16b0317b7f.tar.gz
Fixed possible buffer overflow
-rw-r--r--src/input_win.c6
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];
1'>121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152