Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Aug 2023 13:45:17 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 734518564f9d - stable/12 - libpfct: ensure the initial allocation is large enough
Message-ID:  <202308021345.372DjHEr071086@gitrepo.freebsd.org>

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



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