summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/paste.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-10-12 08:13:53 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-10-12 08:13:53 +0000
commit9b190a7dde0170cacb642fc0e301880457cae98d (patch)
tree1dbb88283e2b256426cf8dbd508768112c14fcaa /usr.bin/tmux/paste.c
parent7428d9e6d3fa161dad4326e6c5c6299c755f3ad6 (diff)
Do not rename a buffer to itself, GitHub issue 4181.
Diffstat (limited to 'usr.bin/tmux/paste.c')
-rw-r--r--usr.bin/tmux/paste.c4
1 files changed, 3 insertions, 1 deletions
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 <nicholas.marriott@gmail.com>
@@ -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);