mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-09 05:54:47 +02:00
Sync OpenBSD patchset 318:
Give each paste buffer a size member instead of requiring them to be zero-terminated.
This commit is contained in:
8
paste.c
8
paste.c
@ -1,4 +1,4 @@
|
||||
/* $Id: paste.c,v 1.8 2009-07-31 20:33:49 tcunha Exp $ */
|
||||
/* $Id: paste.c,v 1.9 2009-09-07 23:48:54 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -97,7 +97,7 @@ paste_free_index(struct paste_stack *ps, u_int idx)
|
||||
}
|
||||
|
||||
void
|
||||
paste_add(struct paste_stack *ps, char *data, u_int limit)
|
||||
paste_add(struct paste_stack *ps, u_char *data, size_t size, u_int limit)
|
||||
{
|
||||
struct paste_buffer *pb;
|
||||
|
||||
@ -115,12 +115,13 @@ paste_add(struct paste_stack *ps, char *data, u_int limit)
|
||||
ARRAY_INSERT(ps, 0, pb);
|
||||
|
||||
pb->data = data;
|
||||
pb->size = size;
|
||||
if (gettimeofday(&pb->tv, NULL) != 0)
|
||||
fatal("gettimeofday");
|
||||
}
|
||||
|
||||
int
|
||||
paste_replace(struct paste_stack *ps, u_int idx, char *data)
|
||||
paste_replace(struct paste_stack *ps, u_int idx, u_char *data, size_t size)
|
||||
{
|
||||
struct paste_buffer *pb;
|
||||
|
||||
@ -131,6 +132,7 @@ paste_replace(struct paste_stack *ps, u_int idx, char *data)
|
||||
xfree(pb->data);
|
||||
|
||||
pb->data = data;
|
||||
pb->size = size;
|
||||
if (gettimeofday(&pb->tv, NULL) != 0)
|
||||
fatal("gettimeofday");
|
||||
|
||||
|
Reference in New Issue
Block a user