From fe5edad1fcd60d94bc45ca49f94636eeecae210d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 2 Jul 2009 16:15:43 +0000 Subject: Fix two copy/paste bugs: forbid zero-length buffers to prevent a fatal error when trying to paste them, found by me, and miscalculation of the start/end causing random fatal errors when copying in copy-mode, reported by sthen. ok sthen "put it in" deraadt --- paste.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'paste.c') diff --git a/paste.c b/paste.c index 3644381c..981385e9 100644 --- a/paste.c +++ b/paste.c @@ -101,6 +101,9 @@ paste_add(struct paste_stack *ps, char *data, u_int limit) { struct paste_buffer *pb; + if (*data == '\0') + return; + while (ARRAY_LENGTH(ps) >= limit) ARRAY_TRUNC(ps, 1); -- cgit