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:
Jacques Vidrine 2004-04-03 15:28:25 +00:00
parent e9c2ca4e26
commit 4f2eff8c32
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127792

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);