From: nicm Date: Thu, 21 Oct 2021 08:36:51 +0000 (+0000) Subject: Correctly adjust the end pointer for a two character terminator before X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9bd2c8e2d25e6ad4f61a734c78e17059e57bfe91;p=openbsd Correctly adjust the end pointer for a two character terminator before decoding OSC 52 response, from Daniel Ekloef in GitHub issue 2942. --- diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index 03853dcbb98..f01ab9a2407 100644 --- a/usr.bin/tmux/tty-keys.c +++ b/usr.bin/tmux/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.150 2021/08/13 07:37:58 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.151 2021/10/21 08:36:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1204,6 +1204,9 @@ tty_keys_clipboard(__unused struct tty *tty, const char *buf, size_t len, buf += 5; end -= 5; + /* Adjust end so that it points to the start of the terminator. */ + end -= terminator - 1; + /* Get the second argument. */ while (end != 0 && *buf != ';') { buf++;