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
This commit is contained in:
Nicholas Marriott
2009-07-02 16:15:43 +00:00
parent 4c5c125173
commit fe5edad1fc
3 changed files with 5 additions and 2 deletions

View File

@ -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);