Add additional range checks for copyout targets.

Submitted by:	Silvio Cesare <silvio@qualys.com>
This commit is contained in:
rwatson 2002-08-09 05:50:32 +00:00
parent 3cb4683ef0
commit 1bb6530f3e
2 changed files with 5 additions and 1 deletions

View File

@ -1330,7 +1330,9 @@ get_palette(video_adapter_t *adp, int base, int count,
int bits;
int error;
if ((base < 0) || (base >= 256) || (base + count > 256))
if ((base < 0) || (base >= 256) || (count < 0) || (count > 256))
return 1;
if ((base + count) > 256)
return 1;
if (!(vesa_adp_info->v_flags & V_DAC8) || !VESA_MODE(adp->va_mode))
return 1;

View File

@ -256,6 +256,8 @@ accept1(td, uap, compat)
error = copyin(uap->anamelen, &namelen, sizeof (namelen));
if(error)
goto done2;
if (namelen < 0)
return (EINVAL);
}
error = fgetsock(td, uap->s, &head, &fflag);
if (error)