From nobody Wed Mar 30 09:17:24 2022 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 0BE541A34AED; Wed, 30 Mar 2022 09:17:26 +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 4KT16Y2qLQz3Gh6; Wed, 30 Mar 2022 09:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648631845; 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=GfeV5gFYeia/7HzSOKfDUzOrV7zZ+lXzuZWCkNk8Mmw=; b=EpPWa7N1Ypn0LLo8+r/spFfjUlJgJw77gfolzZ6tpjJS0JmtPBFr4+6UxONo978Oj2fvkC SsphWwjwt4w67ediSRt2pkgdfFHmKag+mVoMmXzBcET+/+uThK5KM4t328LZ01Xsnfgxbx rMCFgXkeoRIsppJOfO7T5prSoIJcLAsCeasV1KdBjb+yytLZfDEELB1UrAYy62WmweaIUE FzuQ+e6iuY84mcsUT14v5Y2BPpE+lISY5EuK0n0Y9bpChpt9T9bHfHSkwT8huXmZuiyXtB NeohViFUO4KlZw98d5BV3u8b6LwMLFnfDg6gMMklo5jAHZ3xLp8fSeoF/Mx1jg== 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 9370410983; Wed, 30 Mar 2022 09:17:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22U9HOTn091028; Wed, 30 Mar 2022 09:17:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22U9HOjS091027; Wed, 30 Mar 2022 09:17:24 GMT (envelope-from git) Date: Wed, 30 Mar 2022 09:17:24 GMT Message-Id: <202203300917.22U9HOjS091027@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: 81cac0d2f603 - main - pf: add missing input/error validation for DIOCGETETHRULE 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: 81cac0d2f6035e02430fcdfa0ac8a081a9343f8d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648631845; 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=GfeV5gFYeia/7HzSOKfDUzOrV7zZ+lXzuZWCkNk8Mmw=; b=NnhUqOG9064KQQ9f9FuuO/I8u339PXCgPouilARyWgzAXmhWzXh2gK48rj+DKzdH11udat E1DHd+nCl5pdG5lFqzgEB+ChhvKUeQBBoSTOqDNWlAE8TlEP1fXpWgNayXM9zBycxRdqFn ZfazScIseqPZpdBH+47vaFw9oZ5mcN1wMcIWyNmTkj2nRsXdVscNUKWFTC6hcSEoSY7oQB XhizZZgtLwHM/8/t+ANr93Hz+U3n7MrdXX5hQNv0Q4L/MFWJLPyOlv8aiOc55V5oqMU8oQ 0belp8J2xIYXc/d+xHHmYGBB9SAiHhgxleUqodMc+blOSuLXUFGOpuwuUV2BQw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648631845; a=rsa-sha256; cv=none; b=vy+lzFsftw0e0YvhooYroFSLbLd10WIqmFKWZkkC/qBpJkNIf1+hETlJgwKV5e1jTaK/jj ZZi2bgKC/JaJSG5Cxc9CrrdGr6noLhw2aLX95qhXGdxDGmKeIDVDWcPGx0jaGSf7U5hsjq 66EKa+uniF9u1/8+8hrs5MuBWQ8kyuvXolqYf8nJC6Tb7kq+Sd3zleu/mrmD/PYR7hwB0c 0NG57L6eSS1JXNLVKK8UaQ4wYM5x5Upt3GEUlnGiFNxpxMsv8bwowIMWuX5pFJWmf4Eph8 fg4tuecz02jCEM7b/v0Dl2P8X7cetmjRX4q7owVNn3aYzXJVnk54gxoVkNPhpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=81cac0d2f6035e02430fcdfa0ac8a081a9343f8d commit 81cac0d2f6035e02430fcdfa0ac8a081a9343f8d Author: Kristof Provost AuthorDate: 2022-03-29 12:17:12 +0000 Commit: Kristof Provost CommitDate: 2022-03-30 08:28:19 +0000 pf: add missing input/error validation for DIOCGETETHRULE Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 3cb5552d20c5..eae7b3bf1fa0 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2672,6 +2672,9 @@ DIOCGETETHRULES_error: #define ERROUT(x) do { error = (x); goto DIOCGETETHRULE_error; } while (0) + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); if (nvlpacked == NULL) ERROUT(ENOMEM); @@ -2681,6 +2684,8 @@ DIOCGETETHRULES_error: ERROUT(error); nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); if (! nvlist_exists_number(nvl, "ticket")) ERROUT(EBADMSG); ticket = nvlist_get_number(nvl, "ticket");