added check for utf_len in inp_get_char

Addition a symbol is moved under if (utf_len < MB_CUR_MAX) block because wcrtomb can return ((size_t) -1) value.

Also added back forming 'input' as null-terminated string