MFNetBSD:

1.60: Add range checking, but put it higher up in the food
	chain than NetBSD (this should be fixed there as well).

Obtained From: NetBSD
This commit is contained in:
Warner Losh 2002-04-04 22:22:31 +00:00
parent cdef1605ae
commit 15ffbeb81d

View File

@ -1461,6 +1461,10 @@ wi_ioctl(ifp, command, data)
error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); error = copyin(ifr->ifr_data, &wreq, sizeof(wreq));
if (error) if (error)
break; break;
if (wreq.wi_len > WI_MAX_DATALEN) {
error = EINVAL;
break;
}
/* Don't show WEP keys to non-root users. */ /* Don't show WEP keys to non-root users. */
if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS && suser(td)) if (wreq.wi_type == WI_RID_DEFLT_CRYPT_KEYS && suser(td))
break; break;
@ -1512,6 +1516,10 @@ wi_ioctl(ifp, command, data)
error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); error = copyin(ifr->ifr_data, &wreq, sizeof(wreq));
if (error) if (error)
break; break;
if (wreq.wi_len > WI_MAX_DATALEN) {
error = EINVAL;
break;
}
if (wreq.wi_type == WI_RID_IFACE_STATS) { if (wreq.wi_type == WI_RID_IFACE_STATS) {
error = EINVAL; error = EINVAL;
break; break;