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")
This commit is contained in:
Kristof Provost 2023-07-26 10:30:22 +02:00
parent a98a0090b2
commit 6422599e74

View file

@ -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);