From nobody Fri Feb 18 10:46:03 2022 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 4CFBA19CD90F; Fri, 18 Feb 2022 10:46:04 +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 4K0SzJ1hpJz4TsS; 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=JVkx0V0OYn1H0o1CXzgEXOctvdrrmwtOVutxqroXFDk=; b=CHSZYylBfqL6XGaSufBqnn7CToevmoM/q0qgnt/SZ6+D9cQmKIYuhVFJt/j6JoRgLyIwX/ 8sOy39gjZScB6L/dRkTQiRL8X88VU1l0LNQwUKCZNnTPAXflAOam532/U3vE3L7Qg0DFza hrBk9gw18Urvwo1TfpqcRSA6rX613i5B/Ws3P6goTKJ4ZjlUjbD92NDsLoOARW5FUJzRnL rgM3faVmt46kgIxqgECv5AKTrWLQmlZuUn9TYUsCbTAZXGS2da2jJcdJkDC2FXihNbwN1/ VsfmWlYi3KgiW5ppAXt+t3qz1Vkc8KuSv3GgfDqzrcp2i6+swpc3OxPE/Pe3nw== 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 159961BFCE; 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 21IAk3Po043192; Fri, 18 Feb 2022 10:46:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21IAk3aw043191; Fri, 18 Feb 2022 10:46:03 GMT (envelope-from git) Date: Fri, 18 Feb 2022 10:46:03 GMT Message-Id: <202202181046.21IAk3aw043191@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: b5f6f687a2ee - stable/13 - pfctl: improve error reporting for routehost 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: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: 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: b5f6f687a2eea520d93f2c1ca4e04efd7c2e367f 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=JVkx0V0OYn1H0o1CXzgEXOctvdrrmwtOVutxqroXFDk=; b=w6DNvDUS7R3OpXxbbXGCYXn4gv7MUc/GFG+V3NTSvrt3wTjJwL4+Vprn8iTAoQGHKU2wQm OgN67IfsDqtM42zSShlFfjiUBi4jAlowXm4YqexYxUpHomF3aD2EFc8Q4umju6vRuCzqy4 AnZV8ARubS8UpMp+V1FHrhylRUOOFBsg/LAhOgVVq5aY/Js+AaxzPcZoQ1C2j6lP/vGApN 1pVynlLupfuOrOE89KkGen9FY+XfPVh1Wawpm/Y8ZrhjOZF4papDk5BlmZpopIQOWrQILA 6cNXUpKcalb7lvrrsSEWLWDqGjZvScC500zh4tzhWv98qgfQqIErujbE/JT4lQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645181164; a=rsa-sha256; cv=none; b=DocWjmkc/aSCUkgNckXX3888HbMsFjRyVnj3W4Fxv9TvJtU9my8dtIUbR7frXPTzhm2809 EBbcHjDmJw/qXRALi8IPmzSyXCIZ+O7tTESTVdFEVlgezwliu3pQaO9h89nSBas1lawf7D 9EKhDaTqI0aZ0ZLM4Mpge96d3G8cD5pTbOtH2l36HDxjjH0hBMm/YE1OTwDU4UE9rEaXvq pm1hlKakkauK5FHQ2HEJWye6zkDnU7la+oPps9eLAfzArAiI303McjzHaHf/bakn8QO17K IY9/0dRVB3erw4WEoIkhikssIh0TWbvUq9bCgRKVDVzylIeuC7237u1MKdFxgA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b5f6f687a2eea520d93f2c1ca4e04efd7c2e367f commit b5f6f687a2eea520d93f2c1ca4e04efd7c2e367f Author: Kristof Provost AuthorDate: 2022-01-05 20:31:02 +0000 Commit: Kristof Provost CommitDate: 2022-02-18 10:14:58 +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 c075a0d4607c..885b4f5ce50a 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -4544,6 +4544,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; @@ -4553,8 +4557,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); + } } ;