summaryrefslogtreecommitdiffstats
path: root/input-keys.c
diff options
context:
space:
mode:
authornicm <nicm>2016-03-02 15:33:36 +0000
committernicm <nicm>2016-03-02 15:33:36 +0000
commitd980d965ddb6165bd801351892fed2497204a279 (patch)
tree979d2ad29e83620b1a13ce2847a1b0e7ab0aedb3 /input-keys.c
parentf0239a8fe97367ce7ab66d18716c411b424a0e63 (diff)
Limit x, y and b to 0x7ff for UTF-8 mouse input, suggested by schwarze@.
Diffstat (limited to 'input-keys.c')
-rw-r--r--input-keys.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/input-keys.c b/input-keys.c
index 47786d27..41bd5ab5 100644
--- a/input-keys.c
+++ b/input-keys.c
@@ -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]);