git: 734518564f9d - stable/12 - libpfct: ensure the initial allocation is large enough
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Aug 2023 13:45:17 UTC
The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=734518564f9dcfa180dc24d337958a6f8ea94198 commit 734518564f9dcfa180dc24d337958a6f8ea94198 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2023-07-26 08:30:22 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-08-02 08:41:51 +0000 libpfct: ensure the initial allocation is large enough Ensure that we allocate enough memory for the packed nvlist, no matter what size hint was provided. MFC after: 1 week Reported by: R. Christian McDonald <rcm@rcm.sh> Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 6422599e74db4bb8b47cead46760d96601d8396a) --- lib/libpfctl/libpfctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 99ca563548c9..a095cdd1e54b 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -68,6 +68,8 @@ pfctl_do_ioctl(int dev, uint cmd, size_t size, nvlist_t **nvl) int ret; data = nvlist_pack(*nvl, &nvlen); + if (nvlen > size) + size = nvlen; retry: nv.data = malloc(size);