pf: Improve ioctl() input validation
Both DIOCCHANGEADDR and DIOCADDADDR take a struct pf_pooladdr from userspace. They failed to validate the dyn pointer contained in its struct pf_addr_wrap member structure. This triggered assertion failures under fuzz testing in pfi_dynaddr_setup(). Happily the dyn variable was overruled there, but we should verify that it's set to NULL anyway. Reported-by: syzbot+93e93150bc29f9b4b85f@syzkaller.appspotmail.com Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D24431
This commit is contained in:
parent
8fd675d8a0
commit
98582ce381
@ -2643,6 +2643,10 @@ DIOCGETSTATES_full:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
if (pp->addr.addr.p.dyn != NULL) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
pa = malloc(sizeof(*pa), M_PFRULE, M_WAITOK);
|
||||
bcopy(&pp->addr, pa, sizeof(struct pf_pooladdr));
|
||||
if (pa->ifname[0])
|
||||
@ -2742,6 +2746,10 @@ DIOCGETSTATES_full:
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
if (pca->addr.addr.p.dyn != NULL) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pca->action != PF_CHANGE_REMOVE) {
|
||||
#ifndef INET
|
||||
|
Loading…
x
Reference in New Issue
Block a user