diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-08-02 16:13:08 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-08-02 16:13:08 +0000 |
commit | a725f7b84119cee1a43880f6fbe9ef73c1edc07a (patch) | |
tree | 4ed3bcba829808c53ce5e5698482dc8e15668de7 /sys/arch/sun3/dev/bt_subr.c | |
parent | b0e6567fb529f695856bcc0d3526100ee6f1c5a0 (diff) |
Do correct bounds checking in get/set/put cmap routines. A few of
these check were already OK but have been modified for consistency.
Problem found by Silvio Cesare.
Diffstat (limited to 'sys/arch/sun3/dev/bt_subr.c')
-rw-r--r-- | sys/arch/sun3/dev/bt_subr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/sun3/dev/bt_subr.c b/sys/arch/sun3/dev/bt_subr.c index d51468ad11e..17022d60069 100644 --- a/sys/arch/sun3/dev/bt_subr.c +++ b/sys/arch/sun3/dev/bt_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bt_subr.c,v 1.2 1997/01/16 04:03:42 kstailey Exp $ */ +/* $OpenBSD: bt_subr.c,v 1.3 2002/08/02 16:13:07 millert Exp $ */ /* $NetBSD: bt_subr.c,v 1.2 1995/04/10 22:12:48 gwr Exp $ */ /* @@ -74,7 +74,7 @@ bt_getcmap(p, cm, cmsize) start = p->index; count = p->count; - if (start >= cmsize || start + count > cmsize) + if (start >= cmsize || count > cmsize - start) return (EINVAL); if (!useracc(p->red, count, B_WRITE) || !useracc(p->green, count, B_WRITE) || @@ -102,7 +102,7 @@ bt_putcmap(p, cm, cmsize) start = p->index; count = p->count; - if (start >= cmsize || start + count > cmsize) + if (start >= cmsize || count > cmsize - start) return (EINVAL); if (!useracc(p->red, count, B_READ) || !useracc(p->green, count, B_READ) || |