From nobody Wed Jul 26 10:05:21 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R9qJx38fvz4pFCr; Wed, 26 Jul 2023 10:05:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R9qJx2kC8z3kkY; Wed, 26 Jul 2023 10:05:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690365921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/+OjvvTkpQSXGWCEadoQcFQpiURIrthlozmvGbXGQpU=; b=gcrDOH91qPh7hQymxCDlg1FRY/O7E+l7YyK1QrG2231XEJ/5ztVdE0zMsjZoaQ7Qw2GvSs 7imWYTnaOYGbe1jjFoP19S2uZeJLY6ErE5JCj/nqWhueRalgaHkoc42RzkeiKaOnoi2pCF QYYsNnq5HKtx3eMaRHsn5yxalK/motas7W0uLqLx50w/N36nm6DbY8D5ZpgfP8hU0mWcSZ +Lfc0lHCA7zW85i34OcyA7hqQSUgEwDatS26Kb5xA7JWZvl43irSLP0UCDfacY5KY4XUbo uL/ogi3MoW1rNwT254DIg70Rt0dlRlMRipLx0Tb+wPw1uoc5f+FC4h3OsZbJIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690365921; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/+OjvvTkpQSXGWCEadoQcFQpiURIrthlozmvGbXGQpU=; b=JTeX/DOdEDZ7cI00nmafIjwhczdLTb+DWCQCiUe+C1DRF7ORO/aQrg0Ol4qmmdvQNhE5DE ahJ2SuhQONAQj67yl6xlLFzJEVAwElNDOSSURnMNS5fMOfz5KToTDgxD82bVd0+7JXTI6e S+ItvLrl0bo1S8bU9juouhxnu5VxXn2Y72G5FcXIkEzELo9uSpQnHrCwdVOK0gIkAsHMvm Lql8HQzuKzNlsiA1FKqS1iU5YsCl4aGyKlNrIvMp2TR9mZZ2z7Yfm/Is/rTUC/7FI2XvIT cBvIq2QY+S4eDxV6wEhFixx2x5tOR7WO7YCgYAblHPfna9Q4Eo4zhIZKelVtLw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690365921; a=rsa-sha256; cv=none; b=QeI93unHTgVWAyNsEjVUcqbv53Y/komntD779JIbXR+GHcEThBysn9KxiK3ajFiI7CEsRd 34jaYvN8B3nLG6Pr3xiylqtVmaJN/WxNmP5TzrGCBp4v87gVTsP4WDOVhhpahpMgLlIgA1 FSlNGhmnK0TSUVuNjXQs+SgoJkYSwOuCOksqcnFDsjR/NecVh8D8tfjjKuYOq3pl1XU4AW PnR57bY/jvJ8ncgpJx+3X+wmIucG633uTiXH4walI++IsGXqCI2vQT0b68LDPaA02jEpXl 2YU8EtJMax/tU7y1JXscTRYOJqijuMKt4REh5wJ8O8fURp7z4raCjyKm5LkviQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R9qJx1pVhzdZk; Wed, 26 Jul 2023 10:05:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36QA5LF4091447; Wed, 26 Jul 2023 10:05:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36QA5Lck091446; Wed, 26 Jul 2023 10:05:21 GMT (envelope-from git) Date: Wed, 26 Jul 2023 10:05:21 GMT Message-Id: <202307261005.36QA5Lck091446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 6422599e74db - main - libpfct: ensure the initial allocation is large enough List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6422599e74db4bb8b47cead46760d96601d8396a Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6422599e74db4bb8b47cead46760d96601d8396a commit 6422599e74db4bb8b47cead46760d96601d8396a Author: Kristof Provost AuthorDate: 2023-07-26 08:30:22 +0000 Commit: Kristof Provost 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 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);