From patchwork Thu Sep 3 23:00:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Bauer X-Patchwork-Id: 1357113 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=david-bauer.net Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=tiejO1BX; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BjGXX0Jtqz9sTM for ; Fri, 4 Sep 2020 09:02:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=gN9/mTFCbwikRMcnmCVJCrjv7paix+H0HsvfIfC+3ug=; b=tiejO1BXHJHfVjHnWOHt9AW3Lr sp6j3gXpp1cVNlQ07+lxAvz4Aod6gQeE/RPTyUaLYU/qYsDu93lQfK9QFsWLQeGpUwS9FyNA4KHH0 P97pa4oVc77yC9N8VZGP/j5j/oI8dJnCcpwnhARkapRwwS0Wa2O5wxr4qH/O9+VbCJNT05i7OY91p NOKcLuX+G0s1/c8YjQvFMaci7qG0kjvJpFVsRC2NccWgG5phxvCced9TO9Tf62iZTZww9JLduQOtd K7DGNn5EcOK82pIadDYP3SqSHbdX+nyp+dUF01zBT7sYv3uIS5833w1/U9xwiKwjDhN4t5ixubnEa rhqPSrSg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDyDU-00066G-65; Thu, 03 Sep 2020 23:00:28 +0000 Received: from mars.blocktrron.ovh ([2001:41d0:401:3000::cbd] helo=mail.blocktrron.ovh) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDyDQ-000652-2F for openwrt-devel@lists.openwrt.org; Thu, 03 Sep 2020 23:00:25 +0000 Received: from localhost.localdomain (p200300e53f0e9400d343f665ae1b45f9.dip0.t-ipconnect.de [IPv6:2003:e5:3f0e:9400:d343:f665:ae1b:45f9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.blocktrron.ovh (Postfix) with ESMTPSA id 803FC23F9F for ; Fri, 4 Sep 2020 01:00:19 +0200 (CEST) From: David Bauer To: openwrt-devel@lists.openwrt.org Subject: [PATCH] zones: fix max length of zone names Date: Fri, 4 Sep 2020 01:00:11 +0200 Message-Id: <20200903230011.38291-1-mail@david-bauer.net> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200903_190024_235016_7B47C9C8 X-CRM114-Status: GOOD ( 12.22 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Previously the max length of a zone name was assuming the max length for a extension in netfilter is 32 bytes while in reality it is only 29. Fix this incorrect assumption to allow firewall3 to validate the zone name lengths correctly. Signed-off-by: David Bauer --- zones.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zones.h b/zones.h index d786736..beb0e22 100644 --- a/zones.h +++ b/zones.h @@ -22,8 +22,12 @@ #include "options.h" #include "iptables.h" -/* 32 - sizeof("postrouting_") - sizeof("_rule") - sizeof("\0") */ -#define FW3_ZONE_MAXNAMELEN 14 +/* XT_EXTENSION_MAXNAMELEN (29) + * - sizeof("postrouting_") + * - sizeof("_rule") + * - sizeof("\0") + */ +#define FW3_ZONE_MAXNAMELEN 11 extern const struct fw3_option fw3_zone_opts[];