git: 6422599e74db - main - libpfct: ensure the initial allocation is large enough
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 26 Jul 2023 10:05:21 UTC
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6422599e74db4bb8b47cead46760d96601d8396a commit 6422599e74db4bb8b47cead46760d96601d8396a Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2023-07-26 08:30:22 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-07-26 08:30:22 +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") --- lib/libpfctl/libpfctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 28ec89cd2aed..f2cdaebd7592 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);