diff options
author | 2015-11-14 10:56:31 +0000 | |
---|---|---|
committer | 2015-11-14 10:56:31 +0000 | |
commit | 27a2633f85b4171a63c264356037c2d86c882987 (patch) | |
tree | 0c7dc273e0021238ae23fbfe19a618abe5652aa2 /usr.bin/tmux/input.c | |
parent | Push stdout and stderr to clients more aggressively, and add an event to (diff) | |
download | wireguard-openbsd-27a2633f85b4171a63c264356037c2d86c882987.tar.xz wireguard-openbsd-27a2633f85b4171a63c264356037c2d86c882987.zip |
Be more strict about invalid UTF-8.
Diffstat (limited to 'usr.bin/tmux/input.c')
-rw-r--r-- | usr.bin/tmux/input.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index 3a94e3981b3..0730f530d20 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.90 2015/11/14 08:25:12 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.91 2015/11/14 10:56:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -446,11 +446,11 @@ const struct input_transition input_state_ground_table[] = { { 0x1c, 0x1f, input_c0_dispatch, NULL }, { 0x20, 0x7e, input_print, NULL }, { 0x7f, 0x7f, NULL, NULL }, - { 0x80, 0xc1, input_print, NULL }, + { 0x80, 0xc1, NULL, NULL }, { 0xc2, 0xdf, input_utf8_open, &input_state_utf8_one }, { 0xe0, 0xef, input_utf8_open, &input_state_utf8_two }, { 0xf0, 0xf4, input_utf8_open, &input_state_utf8_three }, - { 0xf5, 0xff, input_print, NULL }, + { 0xf5, 0xff, NULL, NULL }, { -1, -1, NULL, NULL } }; @@ -1923,7 +1923,8 @@ input_utf8_open(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; - utf8_open(ud, ictx->ch); + if (!utf8_open(ud, ictx->ch)) + log_fatalx("UTF-8 open invalid %#hhx", ictx->ch); log_debug("%s %hhu", __func__, ud->size); @@ -1936,7 +1937,8 @@ input_utf8_add(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; - utf8_append(ud, ictx->ch); + if (utf8_append(ud, ictx->ch) != 1) + log_fatalx("UTF-8 add invalid %#hhx", ictx->ch); log_debug("%s", __func__); @@ -1949,7 +1951,8 @@ input_utf8_close(struct input_ctx *ictx) { struct utf8_data *ud = &ictx->utf8data; - utf8_append(ud, ictx->ch); + if (utf8_append(ud, ictx->ch) != 0) + log_fatalx("UTF-8 close invalid %#hhx", ictx->ch); log_debug("%s %hhu '%*s' (width %hhu)", __func__, ud->size, (int)ud->size, ud->data, ud->width); |