Sync OpenBSD patchset 318:

Give each paste buffer a size member instead of requiring them to be
zero-terminated.
This commit is contained in:
Tiago Cunha
2009-09-07 23:48:54 +00:00
parent 5edc465802
commit c272de7cba
11 changed files with 73 additions and 59 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-show-buffer.c,v 1.9 2009-08-20 11:35:16 tcunha Exp $ */
/* $Id: cmd-show-buffer.c,v 1.10 2009-09-07 23:48:54 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -18,8 +18,6 @@
#include <sys/types.h>
#include <string.h>
#include "tmux.h"
/*
@ -64,7 +62,7 @@ cmd_show_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
if (pb == NULL)
return (0);
size = strlen(pb->data);
size = pb->size;
if (size > SIZE_MAX / 4 - 1)
size = SIZE_MAX / 4 - 1;
in = xmalloc(size * 4 + 1);