diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/console.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/console.c b/src/console.c index 01b7925..9243e24 100644 --- a/src/console.c +++ b/src/console.c @@ -1,6 +1,7 @@ #include "console.h" #include <assert.h> +#include <ctype.h> #include <stdlib.h> #include <string.h> #include <unicode/utext.h> @@ -104,6 +105,11 @@ void imv_console_input(struct imv_console *console, const char *text) return; } + /* Don't allow newlines or control characters. */ + if (*text == '\n' || iscntrl(*text)) { + return; + } + /* Increase buffer size if needed */ if (strlen(text) + strlen(console->buffer) + 1 > console->buffer_len) { console->buffer_len *= 2; |