summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-paste-buffer.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-07-02 16:15:44 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-07-02 16:15:44 +0000
commite28d27751ccaf23406c552206f2097e666c75aae (patch)
tree490465892a58696709524d9835c54a66095d390d /usr.bin/tmux/cmd-paste-buffer.c
parent45ac9fc274972f19a47bf3a4912e265b916209d6 (diff)
Fix two copy/paste bugs: forbid zero-length buffers to prevent a fatal error
when trying to paste them, found by me, and miscalculation of the start/end causing random fatal errors when copying in copy-mode, reported by sthen. ok sthen "put it in" deraadt
Diffstat (limited to 'usr.bin/tmux/cmd-paste-buffer.c')
-rw-r--r--usr.bin/tmux/cmd-paste-buffer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-paste-buffer.c b/usr.bin/tmux/cmd-paste-buffer.c
index fc01461bc7b..4147e6a1c25 100644
--- a/usr.bin/tmux/cmd-paste-buffer.c
+++ b/usr.bin/tmux/cmd-paste-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-paste-buffer.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: cmd-paste-buffer.c,v 1.2 2009/07/02 16:15:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -63,7 +63,7 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
}
}
- if (pb != NULL)
+ if (pb != NULL && *pb->data != '\0')
buffer_write(w->active->out, pb->data, strlen(pb->data));
/* Delete the buffer if -d. */