diff options
| author | 2017-06-04 09:02:36 +0000 | |
|---|---|---|
| committer | 2017-06-04 09:02:36 +0000 | |
| commit | 9d9ffcabe9781ac214d1f80a2085ec8045640b70 (patch) | |
| tree | 14017d6b9d1acf608a28a7c0c2f56cd6fa90b585 /usr.bin/tmux/input.c | |
| parent | Support SIGUSR2 to stop and start logging for an existing server. Also (diff) | |
| download | wireguard-openbsd-9d9ffcabe9781ac214d1f80a2085ec8045640b70.tar.xz wireguard-openbsd-9d9ffcabe9781ac214d1f80a2085ec8045640b70.zip | |
Be more strict about escape sequences that rename windows or set titles:
ignore any that not valid UTF-8 outright, and for good measure pass the
result through our UTF-8-aware vis(3).
Diffstat (limited to 'usr.bin/tmux/input.c')
| -rw-r--r-- | usr.bin/tmux/input.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index 7eb4b20f7a8..e6ea4c95feb 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.123 2017/06/03 17:43:01 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.124 2017/06/04 09:02:36 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1896,8 +1896,10 @@ input_exit_osc(struct input_ctx *ictx) switch (option) { case 0: case 2: - screen_set_title(ictx->ctx.s, p); - server_status_window(ictx->wp->window); + if (utf8_isvalid(p)) { + screen_set_title(ictx->ctx.s, p); + server_status_window(ictx->wp->window); + } break; case 4: input_osc_4(ictx->wp, p); @@ -1909,7 +1911,7 @@ input_exit_osc(struct input_ctx *ictx) input_osc_11(ictx->wp, p); break; case 12: - if (*p != '?') /* ? is colour request */ + if (utf8_isvalid(p) && *p != '?') /* ? is colour request */ screen_set_cursor_colour(ictx->ctx.s, p); break; case 52: @@ -1945,6 +1947,8 @@ input_exit_apc(struct input_ctx *ictx) return; log_debug("%s: \"%s\"", __func__, ictx->input_buf); + if (!utf8_isvalid(ictx->input_buf)) + return; screen_set_title(ictx->ctx.s, ictx->input_buf); server_status_window(ictx->wp->window); } @@ -1968,9 +1972,10 @@ input_exit_rename(struct input_ctx *ictx) return; log_debug("%s: \"%s\"", __func__, ictx->input_buf); + if (!utf8_isvalid(ictx->input_buf)) + return; window_set_name(ictx->wp->window, ictx->input_buf); options_set_number(ictx->wp->window->options, "automatic-rename", 0); - server_status_window(ictx->wp->window); } |
