summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev/cgfourteen.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-08-02 16:13:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-08-02 16:13:08 +0000
commita725f7b84119cee1a43880f6fbe9ef73c1edc07a (patch)
tree4ed3bcba829808c53ce5e5698482dc8e15668de7 /sys/arch/sparc/dev/cgfourteen.c
parentb0e6567fb529f695856bcc0d3526100ee6f1c5a0 (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/sparc/dev/cgfourteen.c')
-rw-r--r--sys/arch/sparc/dev/cgfourteen.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/arch/sparc/dev/cgfourteen.c b/sys/arch/sparc/dev/cgfourteen.c
index 9c4c0719a4f..372df567452 100644
--- a/sys/arch/sparc/dev/cgfourteen.c
+++ b/sys/arch/sparc/dev/cgfourteen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cgfourteen.c,v 1.9 2002/03/14 01:26:42 millert Exp $ */
+/* $OpenBSD: cgfourteen.c,v 1.10 2002/08/02 16:13:07 millert Exp $ */
/* $NetBSD: cgfourteen.c,v 1.7 1997/05/24 20:16:08 pk Exp $ */
/*
@@ -748,11 +748,11 @@ cg14_get_cmap(p, cm, cmsize)
start = p->index;
count = p->count;
- if (start >= cmsize || start + count > cmsize)
+ if (start >= cmsize || count > cmsize - start)
#ifdef DEBUG
{
- printf("putcmaperror: start %d cmsize %d count %d\n",
- start,cmsize,count);
+ printf("putcmaperror: start %u cmsize %d count %u\n",
+ start, cmsize, count);
#endif
return (EINVAL);
#ifdef DEBUG
@@ -783,11 +783,11 @@ cg14_put_cmap(p, cm, cmsize)
start = p->index;
count = p->count;
- if (start >= cmsize || start + count > cmsize)
+ if (start >= cmsize || count > cmsize - start)
#ifdef DEBUG
{
- printf("putcmaperror: start %d cmsize %d count %d\n",
- start,cmsize,count);
+ printf("putcmaperror: start %u cmsize %d count %u\n",
+ start, cmsize, count);
#endif
return (EINVAL);
#ifdef DEBUG