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/amiga/dev/view.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/amiga/dev/view.c')
-rw-r--r-- | sys/arch/amiga/dev/view.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/amiga/dev/view.c b/sys/arch/amiga/dev/view.c index c5d2e21c40d..7fe31dcdd32 100644 --- a/sys/arch/amiga/dev/view.c +++ b/sys/arch/amiga/dev/view.c @@ -1,4 +1,4 @@ -/* $OpenBSD: view.c,v 1.7 2002/06/11 03:25:43 miod Exp $ */ +/* $OpenBSD: view.c,v 1.8 2002/08/02 16:13:07 millert Exp $ */ /* $NetBSD: view.c,v 1.16 1996/10/13 03:07:35 christos Exp $ */ /* @@ -348,7 +348,10 @@ view_get_colormap (vu, ucm) u_long *uep; /* add one incase of zero, ick. */ - cme = malloc(sizeof (u_long)*(ucm->size + 1), M_IOCTLOPS, M_WAITOK); + if (ucm->size >= SIZE_T_MAX / sizeof(u_long)) + return (EINVAL); + cme = malloc(sizeof(u_long) * ((size_t)ucm->size + 1), M_IOCTLOPS, + M_WAITOK); uep = ucm->entry; error = 0; |