summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-09-07 18:50:46 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-09-07 18:50:46 +0000
commita69d6b71f69b12c01a1ed0990c5f18cdb5b27483 (patch)
treee585fa2a6bbb8d7070e05e0feca593e98fd10564 /usr.bin/tmux/status.c
parent71bc7869f46d0ba653db9646b6ac592389a99d15 (diff)
Give each paste buffer a size member instead of requiring them to be
zero-terminated.
Diffstat (limited to 'usr.bin/tmux/status.c')
-rw-r--r--usr.bin/tmux/status.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index a6469dee67e..18f244fea13 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.31 2009/09/07 10:49:32 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.32 2009/09/07 18:50:45 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -928,9 +928,10 @@ status_prompt_key(struct client *c, int key)
case MODEKEYEDIT_PASTE:
if ((pb = paste_get_top(&c->session->buffers)) == NULL)
break;
- if ((last = strchr(pb->data, '\n')) == NULL)
- last = strchr(pb->data, '\0');
- n = last - pb->data;
+ for (n = 0; n < pb->size; n++) {
+ if (pb->data[n] < 32 || pb->data[n] == 127)
+ break;
+ }
c->prompt_buffer = xrealloc(c->prompt_buffer, 1, size + n + 1);
if (c->prompt_index == size) {