While we're at it, add range checks similar to those in previous commit to

getsockname() and getpeername(), too.
This commit is contained in:
Jacques Vidrine 2002-08-09 12:58:11 +00:00
parent cc6638bd55
commit 5b770403b5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=101583

View File

@ -1354,6 +1354,10 @@ getsockname1(td, uap, compat)
error = copyin(uap->alen, &len, sizeof (len));
if (error)
goto done1;
if (len < 0) {
error = EINVAL;
goto done1;
}
sa = 0;
error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, &sa);
if (error)
@ -1438,6 +1442,10 @@ getpeername1(td, uap, compat)
error = copyin(uap->alen, &len, sizeof (len));
if (error)
goto done1;
if (len < 0) {
error = EINVAL;
goto done1;
}
sa = 0;
error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, &sa);
if (error)