From 232cb8cb3a0aa3add13488f1ce41de70485545ef Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 12 Oct 2024 08:13:52 +0000 Subject: [PATCH] Do not rename a buffer to itself, GitHub issue 4181. --- usr.bin/tmux/paste.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/tmux/paste.c b/usr.bin/tmux/paste.c index 27f61a1b29c..f7993ff8a55 100644 --- a/usr.bin/tmux/paste.c +++ b/usr.bin/tmux/paste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paste.c,v 1.46 2023/02/07 10:56:04 nicm Exp $ */ +/* $OpenBSD: paste.c,v 1.47 2024/10/12 08:13:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -241,6 +241,8 @@ paste_rename(const char *oldname, const char *newname, char **cause) } pb_new = paste_get_name(newname); + if (pb_new == pb) + return (0); if (pb_new != NULL) paste_free(pb_new); -- 2.20.1