Check that saddr->sa_family is a sensible value before using it.

Reported by:	Bryan Fulton and Ted Unangst, Coverity, Inc.
Found by:	The SWAT analysis tool
This commit is contained in:
cperciva 2004-11-28 19:16:00 +00:00
parent ffb27cac2c
commit 4984ccf9bb

View File

@ -129,6 +129,10 @@ vfs_hang_addrlist(mp, nep, argp)
saddr = (struct sockaddr *) (np + 1);
if ((error = copyin(argp->ex_addr, saddr, argp->ex_addrlen)))
goto out;
if (saddr->sa_family > SA_MAX) {
error = EINVAL;
goto out;
}
if (saddr->sa_len > argp->ex_addrlen)
saddr->sa_len = argp->ex_addrlen;
if (argp->ex_masklen) {