Avoid leaking fp references when truncating SCM_RIGHTS control messages.

Reported by:	pho
Approved by:	so
MFC after:	0 minutes
Security:	CVE-2019-5596
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
markj 2019-02-05 17:55:08 +00:00
parent 84203fed6b
commit 255362d099

View File

@ -1605,8 +1605,10 @@ m_dispose_extcontrolm(struct mbuf *m)
fd = *fds++;
error = fget(td, fd, &cap_no_rights,
&fp);
if (error == 0)
if (error == 0) {
fdclose(td, fp, fd);
fdrop(fp, td);
}
}
}
clen -= datalen;