From nobody Fri Feb 18 10:46:04 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 12C0819CD4E0; Fri, 18 Feb 2022 10:46:05 +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 4K0SzJ6Vhfz4TvV; Fri, 18 Feb 2022 10:46:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645181164; 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=XxQMdAc10Vt/uKOZcxuPlDyYZtNTjoUa+bhNkTWdjbY=; b=Qx684IW+UP4uIYBZ1px/pGFRnMYCJccJunCoyu+fk1ER/zcMvOme+KQfgP8TDNJpC7OMMC mksbRTVJOW5Hky+zCmZB92vhOWiF9+7ixx9oRFkXG+5kKF6Qy1sISkknLM6pCB+oSY47zZ P1aKLWUARQgCk+tdrbfGimoD+jXoDnJOSdQAhtvQITBBiFdKXPcix/SGxCSZd4hB9+28Dd IX5fKrO4QsROeLST9wUOeubf8AkZowBzAdZ9fy8lJMvI6RIeDPHSJFki0LkJhxrTPW/OjU PYeoxgaGQJz1xtzeGiV//TDLInWfrB0x37gPdjUfkP99rOrznTg64bJAcuTjNg== 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 AA47B1C228; Fri, 18 Feb 2022 10:46:04 +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 21IAk42i043280; Fri, 18 Feb 2022 10:46:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21IAk4q4043279; Fri, 18 Feb 2022 10:46:04 GMT (envelope-from git) Date: Fri, 18 Feb 2022 10:46:04 GMT Message-Id: <202202181046.21IAk4q4043279@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: 8ac3a1785343 - stable/12 - pfctl: improve error reporting for routehost 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 8ac3a178534344d8b3b0295b831cab763d466c19 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645181164; 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=XxQMdAc10Vt/uKOZcxuPlDyYZtNTjoUa+bhNkTWdjbY=; b=rIP+4AnRPCFNM/2JdDsbjdZ2yXGmPkXgSm4xH+swZj8w2IWd4p0N99y6Pr1rmviULdxooZ yIAP6Z9BRsogRmmDYq2mfBfoQhP23Cg66fQhbqCNQlMg8+P673NbPixTBavZ7Zwy5a2SnU QPZC7yfZ8Cevi6mTmuuNTrlK1RltHGAmlTAgfhR6FX4m3h4H0plhHkAMlSF19Utl4Kh27z a2EmAp92roLxCEoSGUBKfXbq5IRdSncQo/4pN9jr032qsQuEO7o5W/j/2sPhYygW31dEhi zj2mt8+hsltUmS5upEs2jyKE+XezXVjHEZTrYcsSS44pF9GT/P0NyNwZjU1NCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645181164; a=rsa-sha256; cv=none; b=rZa59WzNOxcbLNpEK7sS8cxorZEz3m/4sxBIbyAnOJKY16dhGTfm4eFTl6VL3NpL9VajTf 2J2OgAKC8+JdPGxLlqlKcfFu/uk4O4Epd+E61Rhu0sw9/QiHEvjp6kQgJryax0gXlSGuHU tFzILEmr11ZR1iD6sPlyCFON+m0Er1BCt4HJdz0FEuYV0Pm//KLewSs7hjvI6hYNq7lmQM dx+YVWE23NlgQM+iiPRaC2Z5HBcnBEmQQ5BlbIUDCidedC5WFzDqHYdTpgz0Tk1IL3KLd0 MdKQWF686XaeoqoU5aoD+H9m9YJafTNKrJAp+v5j0/XZGiZSInLrhyiKOujgGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ac3a178534344d8b3b0295b831cab763d466c19 commit 8ac3a178534344d8b3b0295b831cab763d466c19 Author: Kristof Provost AuthorDate: 2022-01-05 20:31:02 +0000 Commit: Kristof Provost CommitDate: 2022-02-18 10:15:31 +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 (cherry picked from commit e68de6694381748b7578703b22580c0f17780b32) --- 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 f06462bda864..1a39e3b2b319 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -4536,6 +4536,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; @@ -4545,8 +4549,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); + } } ;