summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-03-31 22:40:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-03-31 22:40:35 +0000
commit3e2e04c9fe06481896d7c0a594ca0707f9e5318b (patch)
tree638979265319c84e93bcb02968a79c1c77a69219
parentefc5bb557d06da81f2f64af5355b44544bed7c5d (diff)
purge memory in the tty clist rings as we advance; tested by a few
-rw-r--r--sys/kern/tty_subr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c
index e1e976c527d..216c65528a6 100644
--- a/sys/kern/tty_subr.c
+++ b/sys/kern/tty_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty_subr.c,v 1.19 2007/09/07 15:00:20 art Exp $ */
+/* $OpenBSD: tty_subr.c,v 1.20 2008/03/31 22:40:34 deraadt Exp $ */
/* $NetBSD: tty_subr.c,v 1.13 1996/02/09 19:00:43 christos Exp $ */
/*
@@ -107,9 +107,11 @@ getc(struct clist *clp)
goto out;
c = *clp->c_cf & 0xff;
+ *clp->c_cf = 0;
if (clp->c_cq) {
if (isset(clp->c_cq, clp->c_cf - clp->c_cs) )
c |= TTY_QUOTE;
+ clrbit(clp->c_cq, clp->c_cl - clp->c_cs);
}
if (++clp->c_cf == clp->c_ce)
clp->c_cf = clp->c_cs;
@@ -140,6 +142,9 @@ q_to_b(struct clist *clp, u_char *cp, int count)
if (cc > count)
cc = count;
bcopy(clp->c_cf, p, cc);
+ bzero(clp->c_cf, cc);
+ if (clp->c_cq)
+ clrbits(clp->c_cq, clp->c_cl - clp->c_cs, cc);
count -= cc;
p += cc;
clp->c_cc -= cc;
@@ -347,9 +352,8 @@ b_to_q(u_char *cp, int count, struct clist *clp)
if (cc > count)
cc = count;
bcopy(p, clp->c_cl, cc);
- if (clp->c_cq) {
+ if (clp->c_cq)
clrbits(clp->c_cq, clp->c_cl - clp->c_cs, cc);
- }
p += cc;
count -= cc;
clp->c_cc += cc;