Correct a potential panic condition that could be caused when getting or

setting the VGA palette.

Reported by:	Christer Öberg <christer.oberg@texonet.com>
Reviewed by:	bde
This commit is contained in:
nectar 2004-04-03 15:28:25 +00:00
parent 38767798a3
commit 627777410a

View File

@ -2854,7 +2854,8 @@ get_palette(video_adapter_t *adp, int base, int count,
u_char *g;
u_char *b;
if ((base < 0) || (base >= 256) || (base + count > 256))
if (count < 0 || base < 0 || count > 256 || base > 256 ||
base + count > 256)
return EINVAL;
r = malloc(count*3, M_DEVBUF, M_WAITOK);
@ -2885,7 +2886,8 @@ set_palette(video_adapter_t *adp, int base, int count,
u_char *b;
int err;
if ((base < 0) || (base >= 256) || (base + count > 256))
if (count < 0 || base < 0 || count > 256 || base > 256 ||
base + count > 256)
return EINVAL;
r = malloc(count*3, M_DEVBUF, M_WAITOK);