[PATCH] zones: fix max length of zone names

David Bauer mail at david-bauer.net
Thu Sep 3 19:00:11 EDT 2020


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 <mail at david-bauer.net>
---
 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[];
 
-- 
2.28.0




More information about the openwrt-devel mailing list