From 937ba1d8dd9ed6b42a61cef7d9fab761ca6f9dbb Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 19 Aug 2024 08:29:16 +0000 Subject: [PATCH] Both terminators \007 and \033\\ leave the index pointing to the final character of the terminator, so correct the size calculation to always add one. GitHub issue 4082. --- tty-keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tty-keys.c b/tty-keys.c index 17fe47ad..a04d951d 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -1212,7 +1212,7 @@ tty_keys_clipboard(struct tty *tty, const char *buf, size_t len, size_t *size) } if (end == len) return (1); - *size = end + terminator; + *size = end + 1; /* Skip the initial part. */ buf += 5;