diff options
author | 2020-02-03 13:46:27 +0000 | |
---|---|---|
committer | 2020-02-03 13:46:27 +0000 | |
commit | fe77834b662ac53b78174dae819a717b2bd04ccf (patch) | |
tree | 21ec9970bc6892127577d4a22de96f1cd81a1c00 /usr.bin | |
parent | use better markup for challenge and write-attestation, (diff) | |
download | wireguard-openbsd-fe77834b662ac53b78174dae819a717b2bd04ccf.tar.xz wireguard-openbsd-fe77834b662ac53b78174dae819a717b2bd04ccf.zip |
Instead of passing titles through vis() which doubles backslashes, just
ignore any containing control characters or invalid UTF-8. GitHub issue 2070.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cmd-select-pane.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/input.c | 12 | ||||
-rw-r--r-- | usr.bin/tmux/screen.c | 11 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 |
4 files changed, 17 insertions, 16 deletions
diff --git a/usr.bin/tmux/cmd-select-pane.c b/usr.bin/tmux/cmd-select-pane.c index b8b474b5698..b4c0305b7da 100644 --- a/usr.bin/tmux/cmd-select-pane.c +++ b/usr.bin/tmux/cmd-select-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-pane.c,v 1.53 2019/09/24 09:58:58 nicm Exp $ */ +/* $OpenBSD: cmd-select-pane.c,v 1.54 2020/02/03 13:46:27 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -197,8 +197,8 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item) if (args_has(self->args, 'T')) { pane_title = format_single(item, args_get(self->args, 'T'), c, s, wl, wp); - screen_set_title(&wp->base, pane_title); - server_status_window(wp->window); + if (screen_set_title(&wp->base, pane_title)) + server_status_window(wp->window); free(pane_title); return (CMD_RETURN_NORMAL); } diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index 6b1d8a27680..ec8bcaf5a3c 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.169 2020/01/29 15:07:49 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.170 2020/02/03 13:46:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -2213,10 +2213,8 @@ input_exit_osc(struct input_ctx *ictx) switch (option) { case 0: case 2: - if (utf8_isvalid(p)) { - screen_set_title(sctx->s, p); + if (screen_set_title(sctx->s, p)) server_status_window(ictx->wp->window); - } break; case 4: input_osc_4(ictx, p); @@ -2274,10 +2272,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(sctx->s, ictx->input_buf); - server_status_window(ictx->wp->window); + if (screen_set_title(sctx->s, ictx->input_buf)) + server_status_window(ictx->wp->window); } /* Rename string started. */ diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c index bdb5b3e46bc..eced0ac3d53 100644 --- a/usr.bin/tmux/screen.c +++ b/usr.bin/tmux/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.56 2019/11/15 11:16:53 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.57 2020/02/03 13:46:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -152,11 +152,16 @@ screen_set_cursor_colour(struct screen *s, const char *colour) } /* Set screen title. */ -void +int screen_set_title(struct screen *s, const char *title) { + char *cp; + + if (!utf8_isvalid(title)) + return (0); free(s->title); - utf8_stravis(&s->title, title, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL); + s->title = xstrdup(title); + return (1); } /* Set screen path. */ diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 620605fe3e0..64066d8006c 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.953 2020/01/28 13:23:24 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.954 2020/02/03 13:46:27 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -2424,7 +2424,7 @@ void screen_free(struct screen *); void screen_reset_tabs(struct screen *); void screen_set_cursor_style(struct screen *, u_int); void screen_set_cursor_colour(struct screen *, const char *); -void screen_set_title(struct screen *, const char *); +int screen_set_title(struct screen *, const char *); void screen_set_path(struct screen *, const char *); void screen_push_title(struct screen *); void screen_pop_title(struct screen *); |