From nobody Tue Oct 31 15:03:38 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 4SKYLM0GKvz4yTpJ; Tue, 31 Oct 2023 15:03:39 +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 4SKYLL6pPfz3ST6; Tue, 31 Oct 2023 15:03:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698764619; 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=TH9tnRPqq0CxRkK5adJBR/6oqAgruEJT0QYbRcMIJrc=; b=hP3JhsqeAnz2NA866aF2tIjvfaJsbkEmHTbwVQXCvMJFkAjCqNv7+DSQR/Ruzfu4Y2p2tP qG3GTmRSDsxDsiftymlrY+GXHYwc1ykLxmNpfjNEGyukpyEtwnv9AWcmKZ6+0aDmz9jCSz gbuuv15WL6jugG3+yjGydogAkxNU0IlJDwzB9pFXEf8KteMAWYB6Hs0yR7kfi5ED/eCbbe CjbqKpIDLjbX+eLm/XWjYx7IHeO5SWDRULmKk3JGi5qpuQ32SyZ2KY2gQ5EP9ICQIpOhFA ri33x+7Wj8yMSY0rudnYoNd9UZjm//fYrf6qmwIU+Y9YrtJjzQIvKkRSdR8qBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698764619; 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=TH9tnRPqq0CxRkK5adJBR/6oqAgruEJT0QYbRcMIJrc=; b=uIDPdaQV6ka4FpxO9pb5W7/perfa2vLmY1osTx5CI25Ktd6nn2FK+Qhk3MLBw1Yy0ObVUT MsmcB3pQ97By7jaoBrU+di9+pjipIQzIYLctMb8fD1AnL9b4S24Uw2LoQ2FdxL8U4RD86j Yvhgw3QQFt9GnNUvEBT5gUGZ0gkfQPnBgBK8518SI8GUP+Exy4mDiL8Lpj5P3oYxijJRzZ DsNtkoY+uwqa8IrwIjed5PVoM+qA5OyC7DZ7EluGf62if3o1xN2nXlzXeq7pYZoa/4PQoG acebpGKNULXXTN116bD6SfqkLZYmqf9Mfb8j/RErWe46g5cU4sOspCX0wQSMGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698764619; a=rsa-sha256; cv=none; b=jNXFLMMM981jzvhQGaLOEpwxZRYPg26FkvC2Rzet2VtgfjCmWRWorauuQMWeJjwc8bf9AE /pbQP4/9LrlURcilycGuLbg9HeeKY8EowLCFnY0T3XZPXGewJ5XRK2usfNokTDeKgu2bkt 354qRFzoXeNkUii7Zg0yZg09TDvFSD/oYpXPRQ1T8Mm+8nDJQ3XpKGKhD9vCtD3sLzYj31 yWxfrlpI4Y16U2eZi3q1aHlDHosvlYCTAAk8uzIpdJdOx7j7N+bME3AD05KLjN+RW6U4lA DP7s+v8qVeZQ77VNyGClTsqeSBvOhYO08ngQnwl9pBttctsDpRmLpyTpD0+kIA== 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 4SKYLL5mWpz17Xh; Tue, 31 Oct 2023 15:03:38 +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 39VF3cZm048314; Tue, 31 Oct 2023 15:03:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39VF3cqW048311; Tue, 31 Oct 2023 15:03:38 GMT (envelope-from git) Date: Tue, 31 Oct 2023 15:03:38 GMT Message-Id: <202310311503.39VF3cqW048311@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: 2b1eb63fc9c6 - main - libpfctl: be more tolerant of kernel extensions 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: 2b1eb63fc9c6d6f64baaac59b7ea7c2a3228c03f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2b1eb63fc9c6d6f64baaac59b7ea7c2a3228c03f commit 2b1eb63fc9c6d6f64baaac59b7ea7c2a3228c03f Author: Kristof Provost AuthorDate: 2023-10-27 12:13:57 +0000 Commit: Kristof Provost CommitDate: 2023-10-31 15:03:22 +0000 libpfctl: be more tolerant of kernel extensions Allow the kernel to supply more array elements than expected, but cut off when we hit what we think the maximum is. This will improve forward compatibility (i.e. old userspace with newer kernel). Reviewed by: zlei MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D42392 --- lib/libpfctl/libpfctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 1c8873dd6429..1554b81acf59 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -152,9 +152,8 @@ pf_nvuint_32_array(const nvlist_t *nvl, const char *name, size_t maxelems, size_t elems; tmp = nvlist_get_number_array(nvl, name, &elems); - assert(elems <= maxelems); - for (size_t i = 0; i < elems; i++) + for (size_t i = 0; i < elems && i < maxelems; i++) numbers[i] = tmp[i]; if (nelems)