Module Name: src Committed By: dsl Date: Fri Nov 13 19:15:24 UTC 2009
Modified Files: src/sys/kern: tty_subr.c Log Message: Fix clrbits() so that it doesn't mask no bits out of the byte after the range (when the last bit to be cleared is the msb of a byte). Fixes PR/42312 in a slightly better way than proposed. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/kern/tty_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/tty_subr.c diff -u src/sys/kern/tty_subr.c:1.37 src/sys/kern/tty_subr.c:1.38 --- src/sys/kern/tty_subr.c:1.37 Fri Nov 13 19:00:15 2009 +++ src/sys/kern/tty_subr.c Fri Nov 13 19:15:24 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tty_subr.c,v 1.37 2009/11/13 19:00:15 dsl Exp $ */ +/* $NetBSD: tty_subr.c,v 1.38 2009/11/13 19:15:24 dsl Exp $ */ /* * Copyright (c) 1993, 1994 Theo de Raadt @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tty_subr.c,v 1.37 2009/11/13 19:00:15 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tty_subr.c,v 1.38 2009/11/13 19:15:24 dsl Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -312,10 +312,11 @@ return; } + len--; sby = off / NBBY; sbi = off % NBBY; eby = (off+len) / NBBY; - ebi = (off+len) % NBBY; + ebi = (off+len) % NBBY + 1; if (sby == eby) { mask = ((1 << (ebi - sbi)) - 1) << sbi; cp[sby] &= ~mask;