From 89d73fb22a353f9ffa43453e66e8eb28e659d76a Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 18 Feb 2021 13:30:24 +0000 Subject: [PATCH] Reduce len when moving past spaces in OSC 11 parameter. --- usr.bin/tmux/input.c | 6 ++++-- 1 file 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 @@ -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); -- 2.20.1