=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/status.c,v retrieving revision 1.133 retrieving revision 1.134 diff -c -r1.133 -r1.134 *** src/usr.bin/tmux/status.c 2015/08/28 12:16:28 1.133 --- src/usr.bin/tmux/status.c 2015/08/29 09:25:00 1.134 *************** *** 1,4 **** ! /* $OpenBSD: status.c,v 1.133 2015/08/28 12:16:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: status.c,v 1.134 2015/08/29 09:25:00 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 815,824 **** struct options *oo = &sess->options; struct paste_buffer *pb; char *s, *first, *last, word[64], swapc; ! const char *histstr; ! const char *wsep = NULL; u_char ch; ! size_t size, n, off, idx; size = strlen(c->prompt_buffer); switch (mode_key_lookup(&c->prompt_mdata, key, NULL)) { --- 815,823 ---- struct options *oo = &sess->options; struct paste_buffer *pb; char *s, *first, *last, word[64], swapc; ! const char *histstr, *bufdata, *wsep = NULL; u_char ch; ! size_t size, n, off, idx, bufsize; size = strlen(c->prompt_buffer); switch (mode_key_lookup(&c->prompt_mdata, key, NULL)) { *************** *** 1067,1090 **** c->flags |= CLIENT_STATUS; break; case MODEKEYEDIT_PASTE: ! if ((pb = paste_get_top()) == NULL) break; ! for (n = 0; n < pb->size; n++) { ! ch = (u_char) pb->data[n]; if (ch < 32 || ch == 127) break; } c->prompt_buffer = xrealloc(c->prompt_buffer, size + n + 1); if (c->prompt_index == size) { ! memcpy(c->prompt_buffer + c->prompt_index, pb->data, n); c->prompt_index += n; c->prompt_buffer[c->prompt_index] = '\0'; } else { memmove(c->prompt_buffer + c->prompt_index + n, c->prompt_buffer + c->prompt_index, size + 1 - c->prompt_index); ! memcpy(c->prompt_buffer + c->prompt_index, pb->data, n); c->prompt_index += n; } --- 1066,1090 ---- c->flags |= CLIENT_STATUS; break; case MODEKEYEDIT_PASTE: ! if ((pb = paste_get_top(NULL)) == NULL) break; ! bufdata = paste_buffer_data(pb, &bufsize); ! for (n = 0; n < bufsize; n++) { ! ch = (u_char)bufdata[n]; if (ch < 32 || ch == 127) break; } c->prompt_buffer = xrealloc(c->prompt_buffer, size + n + 1); if (c->prompt_index == size) { ! memcpy(c->prompt_buffer + c->prompt_index, bufdata, n); c->prompt_index += n; c->prompt_buffer[c->prompt_index] = '\0'; } else { memmove(c->prompt_buffer + c->prompt_index + n, c->prompt_buffer + c->prompt_index, size + 1 - c->prompt_index); ! memcpy(c->prompt_buffer + c->prompt_index, bufdata, n); c->prompt_index += n; }