summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/input.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2021-02-18 13:30:25 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2021-02-18 13:30:25 +0000
commitf7dab87150455d4e0772d869e606922acf96a1d4 (patch)
tree7d48e9d7eb72ba324b7f55738006b523c80931e1 /usr.bin/tmux/input.c
parent09efe4ecf588d363580912179fe4e3f5d9b04fe8 (diff)
Reduce len when moving past spaces in OSC 11 parameter.
Diffstat (limited to 'usr.bin/tmux/input.c')
-rw-r--r--usr.bin/tmux/input.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index cbf25b2ec3f..0ce7a65adfc 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.187 2021/02/15 14:22:35 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.188 2021/02/18 13:30:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2460,8 +2460,10 @@ input_osc_parse_colour(const char *p)
(1 - m) * (1 - k) * 255,
(1 - y) * (1 - k) * 255);
} else {
- while (*p == ' ')
+ while (len != 0 && *p == ' ') {
p++;
+ len--;
+ }
while (len != 0 && p[len - 1] == ' ')
len--;
copy = xstrndup(p, len);