1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-07 13:14:51 +00:00

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:
Colin Percival 2004-11-28 19:16:00 +00:00
parent 7e07597cfc
commit b96e102ae2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138167

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