summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/input-keys.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-03-02 15:33:37 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-03-02 15:33:37 +0000
commit0cd5b4650ef6c671175dd8c336f0b25caaf290da (patch)
tree9b75f75664ceb5745fd9a53c19059850ec1f9c2d /usr.bin/tmux/input-keys.c
parent292c73e93e88c799bb200b7e84fbb605f5f7b395 (diff)
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]);