iptables: correctly check for too-long chain/target/match names
* iptables-restore was not checking for chain name length
* iptables was not checking for match name length
* target length was checked against 32, not 29.
References: http://bugzilla.netfilter.org/show_bug.cgi?id=641
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
diff --git a/iptables.c b/iptables.c
index 08eb134..25bc8cc 100644
--- a/iptables.c
+++ b/iptables.c
@@ -460,10 +460,10 @@
xtables_error(PARAMETER_PROBLEM,
"Invalid target name (too short)");
- if (strlen(targetname)+1 > sizeof(ipt_chainlabel))
+ if (strlen(targetname) > XT_FUNCTION_MAXNAMELEN - 1)
xtables_error(PARAMETER_PROBLEM,
"Invalid target name `%s' (%u chars max)",
- targetname, (unsigned int)sizeof(ipt_chainlabel)-1);
+ targetname, XT_FUNCTION_MAXNAMELEN - 1);
for (ptr = targetname; *ptr; ptr++)
if (isspace(*ptr))