Skip to content

Commit

Permalink
net/libpfctl: fix pfctl_do_ioctl()
Browse files Browse the repository at this point in the history
pfctl_do_ioctl() copies the packed request data into the request buffer
and then frees it. However, it's possible for the buffer to be too small
for the reply, causing us to allocate a new buffer. We then copied from
the freed request, and freed it again.

Do not free the request buffer until we're all the way done.

While updating also include a few other minor bugfixes
 - handle allocation failure
 - handle pfctl_do_ioctl() failures better

Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit abeb8cd)
  • Loading branch information
kprovost committed Nov 17, 2023
1 parent b1e3058 commit 36019fa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
15 changes: 7 additions & 8 deletions net/libpfctl/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PORTNAME= libpfctl
PORTVERSION= 0.7
PORTVERSION= 0.8
CATEGORIES= net
MASTER_SITES= LOCAL/kp/

Expand All @@ -13,7 +13,8 @@ USE_LDCONFIG= yes

WRKSRC= ${WRKDIR}/libpfctl

_LIBPFCTL_HASH= 87c503235310
_LIBPFCTL_HASH= 498934c5ff51
_LIBPFCTL_REV= 2

PLIST_FILES= \
lib/libpfctl.so \
Expand All @@ -25,7 +26,7 @@ PLIST_FILES= \
.if ${OSREL} == "15.0"
DISTFILES= libpfctl-${_LIBPFCTL_HASH}.tar.gz
.else
DISTFILES= libpfctl-${OSREL}_1.tar.gz
DISTFILES= libpfctl-${OSREL}_${_LIBPFCTL_REV}.tar.gz
.endif

do-install:
Expand All @@ -41,15 +42,13 @@ upload:
do \
cd /usr/src/lib && \
git archive --format=tar.gz \
--output=libpfctl-$${version}.tar.gz \
origin/releng/$${version} libpfctl ; \
--output=libpfctl-$${version}_${_LIBPFCTL_REV}.tar.gz \
libpfctl/$${version} libpfctl ; \
done
cd /usr/src/lib && \
git archive --format=tar.gz \
--output=libpfctl-${_LIBPFCTL_HASH}.tar.gz \
${_LIBPFCTL_HASH} libpfctl ; \
scp libpfctl-*.tar.gz \
kp@freefall.freebsd.org:public_distfiles/
${_LIBPFCTL_HASH} libpfctl ;
.endif

.include <bsd.port.post.mk>
24 changes: 12 additions & 12 deletions net/libpfctl/distinfo
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
TIMESTAMP = 1699359628
SHA256 (libpfctl-12.4_1.tar.gz) = d9b20a2705ff113ef68a3d4b8d139d9eed2db11496a3d5ced979473cd00860eb
SIZE (libpfctl-12.4_1.tar.gz) = 10047
TIMESTAMP = 1699359726
SHA256 (libpfctl-13.2_1.tar.gz) = 41c647ddd909d106435db4c16187789de5925a098d52c462048aa4cb43887b8d
SIZE (libpfctl-13.2_1.tar.gz) = 10043
TIMESTAMP = 1699359643
SHA256 (libpfctl-14.0_1.tar.gz) = 5a43684502ad6ec0ef6b7e77f11c8a5e1b5dc318b30e6c5b8527d1a4f9eb103b
SIZE (libpfctl-14.0_1.tar.gz) = 11619
TIMESTAMP = 1698836124
SHA256 (libpfctl-87c503235310.tar.gz) = 8dd8e6a81b78e9af734ec58899f4f2a3090fccccdaa14a8fa5421cde3e995433
SIZE (libpfctl-87c503235310.tar.gz) = 13383
TIMESTAMP = 1700228381
SHA256 (libpfctl-12.4_2.tar.gz) = 261c701d5c41378058aec9566641aa749ea52732916b76371f8eaadcad8e9b36
SIZE (libpfctl-12.4_2.tar.gz) = 10082
TIMESTAMP = 1700227662
SHA256 (libpfctl-13.2_2.tar.gz) = d14b3df105ad3d532f8d5423fc28e94b4d878f2184204cc7c9fb08ab8b3fec95
SIZE (libpfctl-13.2_2.tar.gz) = 10082
TIMESTAMP = 1700228315
SHA256 (libpfctl-14.0_2.tar.gz) = f5a9b99d0e922ffb2d58c9731dba2baccdac8e77ec73b87f3e8e8510933c5b11
SIZE (libpfctl-14.0_2.tar.gz) = 11665
TIMESTAMP = 1700229758
SHA256 (libpfctl-498934c5ff51.tar.gz) = 58b2d78ce0996e54a10574383642e3877217a8a5099f1db3cb15234539a83931
SIZE (libpfctl-498934c5ff51.tar.gz) = 13462

0 comments on commit 36019fa

Please sign in to comment.