]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC: r296025:
authorkp <kp@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Mar 2016 07:16:35 +0000 (07:16 +0000)
committerkp <kp@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 3 Mar 2016 07:16:35 +0000 (07:16 +0000)
commitc77b9eb0d90ad97659db70d7ab8f497adf366bbf
tree993486756a17a71cc48b355cf2c837af7e10ecfb
parent3bcc26cee72441ed36e7de486fd258c8941e1914
MFC: r296025:

pf: Fix possible out-of-bounds write

In the DIOCRSETADDRS ioctl() handler we allocate a table for struct pfr_addrs,
which is processed in pfr_set_addrs(). At the users request we also provide
feedback on the deleted addresses, by storing them after the new list
('bcopy(&ad, addr + size + i, sizeof(ad));' in pfr_set_addrs()).

This means we write outside the bounds of the buffer we've just allocated.
We need to look at pfrio_size2 instead (i.e. the size the user reserved for our
feedback). That'd allow a malicious user to specify a smaller pfrio_size2 than
pfrio_size though, in which case we'd still read outside of the allocated
buffer. Instead we allocate the largest of the two values.

Reported By:        Paul J Murphy <paul@inetstat.net>
PR:         207463
Approved by: re (marius)

git-svn-id: svn://svn.freebsd.org/base/stable/10@296340 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/netpfil/pf/pf_ioctl.c