diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-09-07 23:48:54 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-09-07 23:48:54 +0000 |
commit | c272de7cbafa343f0e2fc25beb66ed0b924f336f (patch) | |
tree | e44e3f1cc979078b853a0dd84a994b82128556f5 /status.c | |
parent | 5edc4658028b47d975f8685be63f5876a12a3a4f (diff) |
Sync OpenBSD patchset 318:
Give each paste buffer a size member instead of requiring them to be
zero-terminated.
Diffstat (limited to 'status.c')
-rw-r--r-- | status.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.116 2009-09-07 23:37:48 tcunha Exp $ */ +/* $Id: status.c,v 1.117 2009-09-07 23:48:54 tcunha 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) { |