summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/input-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2016-03-02 15:33:36 +0000
committernicm <nicm@openbsd.org>2016-03-02 15:33:36 +0000
commit5b14d177f6dea6a5fd87c241df93ee4e965765d0 (patch)
treebc66dc8f8ab8e319c0f32bbb71c016a22746d580 /usr.bin/tmux/input-keys.c
parentDisentangle the Zaurus bootstrap from compat/linux and move the (diff)
downloadwireguard-openbsd-5b14d177f6dea6a5fd87c241df93ee4e965765d0.tar.xz
wireguard-openbsd-5b14d177f6dea6a5fd87c241df93ee4e965765d0.zip
Limit x, y and b to 0x7ff for UTF-8 mouse input, suggested by schwarze@.
Diffstat (limited to 'usr.bin/tmux/input-keys.c')
-rw-r--r--usr.bin/tmux/input-keys.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c
index 854be5ad18d..c56b3167931 100644
--- a/usr.bin/tmux/input-keys.c
+++ b/usr.bin/tmux/input-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input-keys.c,v 1.54 2016/03/01 12:02:08 nicm Exp $ */
+/* $OpenBSD: input-keys.c,v 1.55 2016/03/02 15:33:36 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -263,6 +263,8 @@ input_key_mouse(struct window_pane *wp, struct mouse_event *m)
len = xsnprintf(buf, sizeof buf, "\033[<%u;%u;%u%c",
m->sgr_b, x + 1, y + 1, m->sgr_type);
} else if (wp->screen->mode & MODE_MOUSE_UTF8) {
+ if (m->b > 0x7ff - 32 || x > 0x7ff - 33 || y > 0x7ff - 33)
+ return;
len = xsnprintf(buf, sizeof buf, "\033[M");
len += input_split2(m->b + 32, &buf[len]);
len += input_split2(x + 33, &buf[len]);