diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2010-06-07 11:50:25 +0200 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2010-06-07 11:56:07 +0200 |
commit | 0cb675b8f18c4b074d4c69461638820708e98100 (patch) | |
tree | 25cf2323eb2d272755b098d29edbb7ef7ede4335 /xtables.c | |
parent | 491c1660fced08e2d1a08c101c63af04250275d0 (diff) |
xtables: another try at chain name length checking
Since XT_EXTENSION_MAXNAMELEN is now available, make use of it
and clear the confusion.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'xtables.c')
-rw-r--r-- | xtables.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -545,10 +545,10 @@ xtables_find_match(const char *name, enum xtables_tryload tryload, struct xtables_match *ptr; const char *icmp6 = "icmp6"; - if (strlen(name) > XT_FUNCTION_MAXNAMELEN - 1) + if (strlen(name) >= XT_EXTENSION_MAXNAMELEN) xtables_error(PARAMETER_PROBLEM, "Invalid match name \"%s\" (%u chars max)", - name, XT_FUNCTION_MAXNAMELEN - 1); + name, XT_EXTENSION_MAXNAMELEN - 1); /* This is ugly as hell. Nonetheless, there is no way of changing * this without hurting backwards compatibility */ @@ -741,8 +741,7 @@ void xtables_register_match(struct xtables_match *me) exit(1); } - /* Revision field stole a char from name. */ - if (strlen(me->name) >= XT_FUNCTION_MAXNAMELEN-1) { + if (strlen(me->name) >= XT_EXTENSION_MAXNAMELEN) { fprintf(stderr, "%s: target `%s' has invalid name\n", xt_params->program_name, me->name); exit(1); @@ -827,8 +826,7 @@ void xtables_register_target(struct xtables_target *me) exit(1); } - /* Revision field stole a char from name. */ - if (strlen(me->name) >= XT_FUNCTION_MAXNAMELEN-1) { + if (strlen(me->name) >= XT_EXTENSION_MAXNAMELEN) { fprintf(stderr, "%s: target `%s' has invalid name\n", xt_params->program_name, me->name); exit(1); |