From nobody Tue Jun 11 13:27:41 2024 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 4Vz8cF2SMQz5LfdZ; Tue, 11 Jun 2024 13:27:41 +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 4Vz8cF1mh2z4fJx; Tue, 11 Jun 2024 13:27:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718112461; 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=xh6s/wN9zph7UNogDV0de46i8ybs0UHDYG47w1GnU6k=; b=PuiHbo6vx0pBHm7HZEOpgcT7E/UpoRRcKMIPiRHK1LNqkyKXrEDS/yaTa9/hNXNI49TU0p ra/W5yKPqJ1/XVyG/xUZIm0oMsMVaKEFzGKSrCSKiqD1p3mNIzyjwDpSohQvaexA3AeSwn aWLbZz7GnzECyqp8k0iqi0kG50AOvk63iBSrhZEaxz1IdBMllkrDv1CYEjaeFrn1dUHsLM CCPI4sOeWHA96bVMWtVm3M3oA7ksyO0IRlK0yAWOg9XdjzT25Y7ao1mt30tPWgTxSWk1LQ +2e5Zs2OPUsKem8ipG0yrAr0WCVSeYaEx1XsrGx1quFgJm1yI5gj+BcYSXhPgw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718112461; a=rsa-sha256; cv=none; b=qYE2Q0VszJd+sUBD0qlZiwtOazJrmxyM7M/s+lVFzsYHv6hQkAmBpSvFV9aCx5Uy7UetNk iHdh6MtK6Opdr+8U49w0v8x1LvTehfZ/OqriaXE/5Xf2Urp6TLA2eJNFdxnflJ6zeFE/zh ImFyUEMShmPMHRD91O3GOVTADvAi+P7Peo4SWkFSLZr1qe3tJ7uikoYPuhkpUEQ2WDm4GH m0kym5OmkfENfVRIjZ+3V3p1P5GMi+EASu7z+BWfnblKLSyBQaERALlm0kwBfW8hdI/fNa 7X7xdHtVyvBnCiiUe13/vccctUaXPw39v6wkUogBXl1lWc8z4qvwZL3Ggm6ydQ== 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=1718112461; 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=xh6s/wN9zph7UNogDV0de46i8ybs0UHDYG47w1GnU6k=; b=jnAvVbdUGusQtf8ULQQti2fkk5SVVlT4YH/JPCyEyzvtiaM60NgIrT0gIdICLmGZU0T5+m Q/0yTJs8Pe1KmI8IzF2nKqiIapdBAYf8bVXK+balhacTvYYAqf0zmxvowPXMQ/LOGl/0qW kzVtPTMTcGxf4zHNkD9jGN01L1UuQID7jS9fvniiGeSH7F5A5ADG2mtOOVcIYPFZZ8YsH6 ieyH3wn3+oc8EjxHs9e9TqeLNpY+GbaOVtT42OjaGbnyuuLjfnJdFPq5PnZwi+bGG4ZSc3 njbXhRYBRPWVVyZVQPjw4VltN5VYK9jvPWyJw+Zib0KgG3SJ2X0Kr/UEbSePSA== 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 4Vz8cF1KSJz19nv; Tue, 11 Jun 2024 13:27:41 +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 45BDRfw0072979; Tue, 11 Jun 2024 13:27:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45BDRfmr072971; Tue, 11 Jun 2024 13:27:41 GMT (envelope-from git) Date: Tue, 11 Jun 2024 13:27:41 GMT Message-Id: <202406111327.45BDRfmr072971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 8fb5dc88ad8e - stable/14 - pf: fix overly large copy in pf_rule_to_krule() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/stable/14 X-Git-Reftype: branch X-Git-Commit: 8fb5dc88ad8edbf3ab2a60fff4c2af2ad71fceae Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8fb5dc88ad8edbf3ab2a60fff4c2af2ad71fceae commit 8fb5dc88ad8edbf3ab2a60fff4c2af2ad71fceae Author: Kristof Provost AuthorDate: 2024-06-04 12:55:02 +0000 Commit: Kristof Provost CommitDate: 2024-06-11 06:06:04 +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 (cherry picked from commit 4779b16fa61f858ad5c449834f550fbd5e162d98) --- 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 1a383ae6fd09..7c148d857144 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2071,7 +2071,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;