summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-06-04 09:02:37 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-06-04 09:02:37 +0000
commit1e19e4992bacd93b3ad49d2ede105234949b3408 (patch)
treef16dc1ddf04104f14226ec4090bf7cf8f742a011 /usr.bin/tmux/window.c
parentb51b06c97665d8f1eafbd2fee4d3d9b4a8811d13 (diff)
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/window.c')
-rw-r--r--usr.bin/tmux/window.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index 66b11660288..a890801a498 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.197 2017/05/31 10:15:51 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.198 2017/06/04 09:02:36 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -29,6 +29,7 @@
#include <time.h>
#include <unistd.h>
#include <util.h>
+#include <vis.h>
#include "tmux.h"
@@ -408,7 +409,7 @@ void
window_set_name(struct window *w, const char *new_name)
{
free(w->name);
- w->name = xstrdup(new_name);
+ utf8_stravis(&w->name, new_name, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL);
notify_window("window-renamed", w);
}