aboutsummaryrefslogtreecommitdiff
path: root/paste.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-07-02 16:23:54 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-07-02 16:23:54 +0000
commit29ac832cb38f2193866a3fa5b14abc7537852eb4 (patch)
tree862827f88fa3204e0e8bc24d8a50b0b5cfe327de /paste.c
parent85dac1e378ed398ff5f6fd861b9874ec2f9ad2f5 (diff)
downloadrtmux-29ac832cb38f2193866a3fa5b14abc7537852eb4.tar.gz
rtmux-29ac832cb38f2193866a3fa5b14abc7537852eb4.tar.bz2
rtmux-29ac832cb38f2193866a3fa5b14abc7537852eb4.zip
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.
Diffstat (limited to 'paste.c')
-rw-r--r--paste.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/paste.c b/paste.c
index 418c5a0c..36c40060 100644
--- a/paste.c
+++ b/paste.c
@@ -1,4 +1,4 @@
-/* $Id: paste.c,v 1.6 2009-01-25 18:51:28 tcunha Exp $ */
+/* $Id: paste.c,v 1.7 2009-07-02 16:23:54 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);