Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jul 2023 10:05:21 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 6422599e74db - main - libpfct: ensure the initial allocation is large enough
Message-ID:  <202307261005.36QA5Lck091446@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307261005.36QA5Lck091446>