From nobody Tue Jun 04 17:44:54 2024 X-Original-To: dev-commits-src-main@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 4VtyfG22D6z5MHpH; Tue, 04 Jun 2024 17:44:54 +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 4VtyfG1Lvsz4L40; Tue, 4 Jun 2024 17:44:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717523094; 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=c64MkCuF5SoiZlwz2RLmi9fRuvJhe/yL3jnvOO8+Efg=; b=Vg155FaZwSmOQbYVnAMByhHXPQBFojBsW/3c19FVSh5O4vtxAq2t3JnhE706XFo4ellcqR t4iLmXuh+D7mbcP23dAeX0zHs6aw8+FXueT/Idh5T4k7WDBito0j3AI7NDfpo76GpPiBe7 X0niDxeagm2CcJvkYnbTTFRj9QX50pybHZ++CWwgMs4/E+Qoi3qrgUMywcWObwQo7AJG25 Tg0B31WDQ9FmE6raSub8YVZ4ql9C0MjbPl5iQVAZDZRxufAcFhrISxFSsSAopwkrDVL/uO kYE56XJCw1FmiUeeR3wtX64sQF5tfAh+HrRWtc+TWSEzm5b21QlGA10v0L/l4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717523094; a=rsa-sha256; cv=none; b=W+pWCu8DhtZ+hkCcYxLTFWeDFb6ggKI4L8coWg/Rwjcf6fu8/IVLjt0kx0v66NQot/cI5s fltyqzeQNxJHVGZdYjcEpc/mJQwnfJYVOlsSEsiXcX8kNjGTBUIBn8G09z0eVR87WaeefD kVbjZRBfj1BRnPRtZUDFoH6JxiWGvNJ/OTB0V0ETYT0qPZ9z3OqP0fdwiN633EPdamdDe5 LxYVzzLVHOzbEkJGvUncKD2rn0MtylC46FKuvABKat4Uqh/Y9+7hhNIHS8rUHilPpnnJ+a YU+UdWAGC2mc0H7r8oMNyfinFMiDz+rV0fcmLwLVLv6hn/q6lhnmsKPBr4l8hA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717523094; 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=c64MkCuF5SoiZlwz2RLmi9fRuvJhe/yL3jnvOO8+Efg=; b=ugexQ+lD0wciVy3dai/A6BKlNHq+s4exLbD6O0qE0th5sDjBJWjVaa0N1HlGLT4Z26jiK1 jSryyKvkHWlaMr1dSj/1m80RDkDoKA6DZrHMja48JH3K3U7q8fsnen/psn3LLLVXAa9kZy fVJk8Xydv/CG8IFI7qvLSFjh8bD9C5VkWkOTOIIXy5AdVpjR8TYbb1HcHu46MS+FaQ2jvM 8qw5LPQBouky8+acsv/EnYAuR263BUj86f0FetxsL7vyaaODUk1zb5kbjRQg2GjXNR6WPz MGkLTBjx+im82r643qz4E/5/BElH8/k2r2gQM8LQ38VQ64rV6slrKU3Lva82HQ== 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 4VtyfG0yBQzS7S; Tue, 4 Jun 2024 17:44:54 +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 454HisjR037054; Tue, 4 Jun 2024 17:44:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454HisFP037051; Tue, 4 Jun 2024 17:44:54 GMT (envelope-from git) Date: Tue, 4 Jun 2024 17:44:54 GMT Message-Id: <202406041744.454HisFP037051@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: 4779b16fa61f - main - pf: fix overly large copy in pf_rule_to_krule() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 4779b16fa61f858ad5c449834f550fbd5e162d98 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4779b16fa61f858ad5c449834f550fbd5e162d98 commit 4779b16fa61f858ad5c449834f550fbd5e162d98 Author: Kristof Provost AuthorDate: 2024-06-04 12:55:02 +0000 Commit: Kristof Provost CommitDate: 2024-06-04 17:44:20 +0000 pf: fix overly large copy in pf_rule_to_krule() The timeout array in struct pf_rule has PFTM_OLD_MAX entries, the one in struct pf_krule has PFTM_MAX entries (and PFTM_MAX > PFTM_OLD_MAX). Use the smaller of the sizes when copying. Reported by: CheriBSD MFC after: 1 week Event: Kitchener-Waterloo Hackathon 202406 --- sys/netpfil/pf/pf_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index be5e38664a76..99cb3bd85d57 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1972,7 +1972,8 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) krule->os_fingerprint = rule->os_fingerprint; krule->rtableid = rule->rtableid; - bcopy(rule->timeout, krule->timeout, sizeof(krule->timeout)); + /* pf_rule->timeout is smaller than pf_krule->timeout */ + bcopy(rule->timeout, krule->timeout, sizeof(rule->timeout)); krule->max_states = rule->max_states; krule->max_src_nodes = rule->max_src_nodes; krule->max_src_states = rule->max_src_states;