From nobody Tue Jun 11 13:27:41 2024 X-Original-To: dev-commits-src-branches@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 4Vz8cF2WmVz5LfqP; 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 4Vz8cF1q3Tz4fd6; 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=YxxQzD0llWaoJtPi+o213mhovubUdjIOHN49Y4UVRaA=; b=W6z+hnOaL0nmcgFk5zoaln5LuQejaSuLBeH6Z5Du+MAz8V3QvX9U53NnIYUYIq6sbSGV8d j5i15ssNQDhUSppeAdR3ehGkOj+9yADR+cmMpLR0L62LKgY/dQ6R16Y0cIk82gCKFMjBd8 lNC4NAxx6pHZDF124W2n4XFfP+eZYUdRzYuqOiIqkuYYzFXYxdMW+ziOjsTNnmNye/5jPl ozKkzA9WL9/pA1+VPewF7i2JzV8GP90V5n79hGB0IPUJCYI8x0nN2N/beej3Aa8D6FhT05 etAfGGBI4rkM4IfhAuaBDRJYihl9wePS5Qrst6Zg4D7TInFohzT4wnguGLw21A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718112461; a=rsa-sha256; cv=none; b=T/x3PV56B8xa9PYzcDatsJrJXZj6wbu634Ae8VSX2pUAuwTznpVTx1SQsQh8V77D6iYq5/ Vfpyw6MsZh1dmFI6YnNrc3Z8AZNEgz+2eM5nPP9ugZSuJF48EzfQMxn6PC1tJxwy3wjd1H cqifkQHzyAvdi6hvtCgS3XyLIIaW3wZhCUGd4Soc4gFy0FuREQAxXdD9j/Dx1pQI/KxCoj rxndMQcSQpwjvW4r69jcHwaOR44O+Z3IbJeHLv8TPaUYG0i3r8OpN5PgeTmLLxvozYZUgQ lGzWYT/ynY+TSez104I4hAwWnJsBVzZZ9lrZ0mYuIhSaUCjtlHIdue3tcM/6hA== 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=YxxQzD0llWaoJtPi+o213mhovubUdjIOHN49Y4UVRaA=; b=NDDsfjObUQtSGdlZ2hpy4me2bvN9LthUcuHVEHJNxHWzoR6gY0aVOL8n2CAzc2UvlmuvaV z7VvVSylgzpf5/eiznVJcPkk/hYrajX+Uxq5nDb3Yj1ppjcUehjv4JJUgTGuQo1w9tPTEe kGvyKvjSl1xFUbUaBWC+2lb/96xnkjg4LtVioahBEJU/HR+wbrzu/+JFPMU/p+so35wz1S XhEGKW1X+1hYxuPUbhkFkvsfMX6CBgaRVn0CVdZrd9gbvDA21lNvH7pjdF6hLDG77TSp5+ Kef4+kviB7uSI0V4phrqlIJWBvr3spu2znYSqh1talxcfz7HDZH/I6bbVBr3Pg== 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 4Vz8cF1M06z19M9; 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 45BDRfxE072980; 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 45BDRfV6072976; Tue, 11 Jun 2024 13:27:41 GMT (envelope-from git) Date: Tue, 11 Jun 2024 13:27:41 GMT Message-Id: <202406111327.45BDRfV6072976@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: d92f239a92c4 - stable/13 - pf: fix overly large copy in pf_rule_to_krule() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: d92f239a92c448f2954fd4c14775a36532a78dc6 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d92f239a92c448f2954fd4c14775a36532a78dc6 commit d92f239a92c448f2954fd4c14775a36532a78dc6 Author: Kristof Provost AuthorDate: 2024-06-04 12:55:02 +0000 Commit: Kristof Provost CommitDate: 2024-06-11 06:06:11 +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 98b5ce318596..a7f9f2604068 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1799,7 +1799,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;