From nobody Thu Jan 27 07:51:02 2022 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 D3C13198FC6D; Thu, 27 Jan 2022 07:51:02 +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 4Jkt7V5c9Bz3q0x; Thu, 27 Jan 2022 07:51:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643269862; 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=ALCpD9pmWPjcYpMYSR3lXnqr9IiAfgimuZ9H4W4GpsE=; b=qaysvRuaQi9311zUnTc9uB/wh02Q8gyxgibeKHcxGJHiPeEc+6lvRBdAZ4j4ehEW9S+x4Y Q2AUb0jPZKQlVJ21IN1YH+5R2E54YmB6ZcibDw+mgmxH8V1ryzEt46dnaJXC884hIzlqNY TBRbsvZBaOiK+7DdNUi57O0HdLDANGngqzL+HzfvpOSqycqO4i6Bzf9+ruU/RIHZ8m6tGz u2T1wUEQUSdzKuBzJ6oUYYj9BfhrD1xyWIAMtPQ5JP5lgYrRJuY7bHi3OU5n+ZnhyjpUOu zz/0/UG1CrlcYB2SRDzSarkOGNkMz+N9uFAQbtrDm7aH8w0mRcTHcqchkgZfLg== 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 A0AEE12D3A; Thu, 27 Jan 2022 07:51:02 +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 20R7p2L0012690; Thu, 27 Jan 2022 07:51:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20R7p2M5012689; Thu, 27 Jan 2022 07:51:02 GMT (envelope-from git) Date: Thu, 27 Jan 2022 07:51:02 GMT Message-Id: <202201270751.20R7p2M5012689@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: e68de6694381 - main - pfctl: improve error reporting for routehost 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: 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: e68de6694381748b7578703b22580c0f17780b32 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643269862; 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=ALCpD9pmWPjcYpMYSR3lXnqr9IiAfgimuZ9H4W4GpsE=; b=Okgz5cAkRLVkNMQXfaz9zM8LAubyWuETgjTZlthlTyU/m/WtC7MiHvCI2FyVWNFlpF9nLE EIyoGp+gu5bxFWtnNMWLfXCtt+uIfm1UjKMa49pecKFcg87GvEg6VtMeaFGeQ0BCZbBH0i 1qoWIRyV/Ly0FH4BEIGAB3lBb7RMavs9FeIaAasND4modegcZjTKBMYgbtNBnLD0ortS5j M/yEGR0WkneFB3cOvcvIpYVL4nT2GIeZyjFpuOx12Zoz6lNm0UhmNdEWC0M8Y7QQKggKkl KCtsOpG+47Bz0Fi8CiKDe8aMz9sioAMMx3CYfWr5h6MFZTLiW6YIw6hwuJbIfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643269862; a=rsa-sha256; cv=none; b=LoR5Xm51d0XX4IpoZ08aqTOICGULU8uv2SQHeJqHMDMc+4We48wFLf8/C0B2Fub1bl3heh ZQcASNex/9A3oNYD9C/57tTT5zLiVTI2joKqudcQ4FOKGOefrESGceZfsXgik5iy/0Mb3S 6tk7ba9fWuq0tl7JV2VM+1QtTABkNWG7l0upqZwicGIgmPJ8Ny6CBUnNWmYCd9G6aYnQ2T Vj5b4/1+9VHIZyctz9TQwne1H0DlcYMVER5kEzfvuY/4E8zlvuyAbU3+ICHaaEMG2yFqPx +3vIco1GnZOIdW3G5gNnITKLg5eIhTiS1v0BlTtf19F5Rgu8F1TwX8k0FN9zhw== 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=e68de6694381748b7578703b22580c0f17780b32 commit e68de6694381748b7578703b22580c0f17780b32 Author: Kristof Provost AuthorDate: 2022-01-05 20:31:02 +0000 Commit: Kristof Provost CommitDate: 2022-01-27 06:36:26 +0000 pfctl: improve error reporting for routehost If an invalid (i.e. overly long) interface name is specified error out immediately, rather than in expand_rule() so we point at the incorrect line. PR: 260958 MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D34008 --- sbin/pfctl/parse.y | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index a21643070028..f931d1c062b9 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -4582,6 +4582,10 @@ route_host : STRING { $$ = calloc(1, sizeof(struct node_host)); if ($$ == NULL) err(1, "route_host: calloc"); + if (strlen($1) >= IFNAMSIZ) { + yyerror("interface name too long"); + YYERROR; + } $$->ifname = strdup($1); set_ipmask($$, 128); $$->next = NULL; @@ -4591,8 +4595,13 @@ route_host : STRING { struct node_host *n; $$ = $3; - for (n = $3; n != NULL; n = n->next) + for (n = $3; n != NULL; n = n->next) { + if (strlen($2) >= IFNAMSIZ) { + yyerror("interface name too long"); + YYERROR; + } n->ifname = strdup($2); + } } ;