From nobody Thu Jun 06 13:46:07 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 4Vw5Fr130Gz5MWVB; Thu, 06 Jun 2024 13:46:08 +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 4Vw5Fr0HMMz3yfy; Thu, 6 Jun 2024 13:46:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717681568; 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=YyNaBR60aF+ImaYv4p+HqWJZrwffFhBXjXe6MiTtFAM=; b=btFkNOp6I0qPOo1fLL86e1So+RisbZjO+uqGdRw0vBNRw8pmyvD1BDcIHBbLLnIR0k57fY MdKFn8I/3MPhFPzHJQbjc60FFt2NNdaffC5ewGXjiSBkRlpu1/HzAE1sbk8TKJfgSehrEL gcWtgqKMyNa6DXZM4EEugTLzJ1KVBdhahbpaM+NaLVDq4cdvMgHGwbUAx1WBPT+sfXx6Bf j5N5EJAY1W+H0omuSWruO5DhxR4VUQ2JmWURm/LzwFOLxQ9lhZLYKFjSryVMQduv6EbbVq vtOd6nSCReR/gmcKaOkWwtWW99ZxOhgw4fDCg8s1muqyYgBzjIfFy0OpLFeZpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717681568; a=rsa-sha256; cv=none; b=nKVeqCJOGHmttf6lTOomdo00rnijG8oCw/DOKSLeNZ92k+k9AFf9zrVjw9Z9KeJxTw7o1o b7zXKJZBsDDpvgJXZqR8gxCniAJorMT5liX34jheIIhbvTGdH33xoL2O0qSGc9fgzS+2Y7 QT0hijAWUN8uPKMCb/E17fiNrp59PyR5bIF8Dbx0SFCjnfPqUCv+DUv56KWEB52cKPWev0 M1TOBKYqi/XEKJFiEvs5nyecLMy0iWt4zFZOeiBHoMj97B2xdulonSd+pliuwzXJW/OZpO Rg/mrX3IaclrpZy11/Bm61Crxbr9juovMO3TONcGk/CC3GqdKEHXfW9FQ1gdEQ== 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=1717681568; 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=YyNaBR60aF+ImaYv4p+HqWJZrwffFhBXjXe6MiTtFAM=; b=gePB+5cu5QbMdEEuxcyQCG6/K30mRsKFNjbTbPDuGrUJeUkwwXrV6nTSPRweU6r3Ja6q/k 4zcfVmnOYxjwqtR5ZJ1V0FJ35JS/0LlCoM8Pjo1EbGLM6i5dc2LBREzJEfqHnqzXhQAT1g A2MJZlyOH8Hlaisai5Iflp1rphDvxS3/tCKceir4CzcitJosVcwPTfNHsuRhIq/hkmcIC/ yKLYh9jcaB2EVtUc/Lzo3NWKuCjAvf8lhZJfw06Z02SBXYCOngg5G0Wwp8nAqRUKe/Tm2T QG85S1KBBCnXFbkUFtMutkGVYHKQTTDrisiHnSEirZ8F5GjjP7ETY62jF8WADw== 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 4Vw5Fq71V1zpDt; Thu, 6 Jun 2024 13:46:07 +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 456Dk719010728; Thu, 6 Jun 2024 13:46:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Dk7A5010725; Thu, 6 Jun 2024 13:46:07 GMT (envelope-from git) Date: Thu, 6 Jun 2024 13:46:07 GMT Message-Id: <202406061346.456Dk7A5010725@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: dc3ee89c86d3 - main - pfctl: fix possible out-of-bounds read 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/main X-Git-Reftype: branch X-Git-Commit: dc3ee89c86d30cc7a14dce9550bbd4d37c7ff182 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dc3ee89c86d30cc7a14dce9550bbd4d37c7ff182 commit dc3ee89c86d30cc7a14dce9550bbd4d37c7ff182 Author: Kristof Provost AuthorDate: 2024-06-05 21:55:37 +0000 Commit: Kristof Provost CommitDate: 2024-06-06 13:45:31 +0000 pfctl: fix possible out-of-bounds read Tags in $10 (filter_opts) are not guaranteed to be the maximum possible tag length, so memcpy() can end up reading outside of the allocated buffer. Use strlcpy() instead. Reported by: CheriBSD Event: Kitchener-Waterloo Hackathon 202406 --- sbin/pfctl/parse.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 92e6e36f3b23..19e029c881d1 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1230,7 +1230,7 @@ etherrule : ETHER action dir quick interface bridge etherproto etherfromto l3fro r.direction = $3; r.quick = $4.quick; if ($10.tag != NULL) - memcpy(&r.tagname, $10.tag, sizeof(r.tagname)); + strlcpy(r.tagname, $10.tag, sizeof(r.tagname)); if ($10.match_tag) if (strlcpy(r.match_tagname, $10.match_tag, PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) { @@ -1240,7 +1240,7 @@ etherrule : ETHER action dir quick interface bridge etherproto etherfromto l3fro } r.match_tag_not = $10.match_tag_not; if ($10.queues.qname != NULL) - memcpy(&r.qname, $10.queues.qname, sizeof(r.qname)); + strlcpy(r.qname, $10.queues.qname, sizeof(r.qname)); r.dnpipe = $10.dnpipe; r.dnflags = $10.free_flags; if (eth_rule_label(&r, $10.label))