diff options
author | 2009-07-02 16:15:43 +0000 | |
---|---|---|
committer | 2009-07-02 16:15:43 +0000 | |
commit | 92e1fe33b4acbba8302d657e18e95c726b0dbfc6 (patch) | |
tree | abf72dd88cc67b8172c4e67b2eb57c2984168a2f /usr.bin/tmux/paste.c | |
parent | Rewrite the sysctl handlers to use libc functions (getifaddrs and (diff) | |
download | wireguard-openbsd-92e1fe33b4acbba8302d657e18e95c726b0dbfc6.tar.xz wireguard-openbsd-92e1fe33b4acbba8302d657e18e95c726b0dbfc6.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.
ok sthen "put it in" deraadt
Diffstat (limited to 'usr.bin/tmux/paste.c')
-rw-r--r-- | usr.bin/tmux/paste.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/tmux/paste.c b/usr.bin/tmux/paste.c index 2f091406e4c..a76b47eea52 100644 --- a/usr.bin/tmux/paste.c +++ b/usr.bin/tmux/paste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: paste.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */ +/* $OpenBSD: paste.c,v 1.2 2009/07/02 16:15:43 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); |