diff options
| author | Jan Engelhardt <jengelh@medozas.de> | 2010-04-27 09:34:34 -0400 |
|---|---|---|
| committer | Patrick McHardy <kaber@trash.net> | 2010-04-27 09:34:34 -0400 |
| commit | 4b2cbd42bef5a22bb681acd607a7c3fbca1eeb3c (patch) | |
| tree | ec3461cd593eaf65ffcd3fbb538c3976da1caa60 | |
| parent | af740b2c8f4521e2c45698ee6040941a82d6349d (diff) | |
netfilter: x_tables: rectify XT_FUNCTION_MAXNAMELEN usage
There has been quite a confusion in userspace about
XT_FUNCTION_MAXNAMELEN; because struct xt_entry_match used MAX-1,
userspace would have to do an awkward MAX-2 for maximum length
checking (due to '\0'). This patch adds a new define that matches the
definition of XT_TABLE_MAXNAMELEN - being the size of the actual
struct member, not one off.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
| -rw-r--r-- | include/linux/netfilter/x_tables.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 50c867256ca3..eeb4884c30be 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | 5 | ||
| 6 | #define XT_FUNCTION_MAXNAMELEN 30 | 6 | #define XT_FUNCTION_MAXNAMELEN 30 |
| 7 | #define XT_EXTENSION_MAXNAMELEN 29 | ||
| 7 | #define XT_TABLE_MAXNAMELEN 32 | 8 | #define XT_TABLE_MAXNAMELEN 32 |
| 8 | 9 | ||
| 9 | struct xt_entry_match { | 10 | struct xt_entry_match { |
| @@ -12,8 +13,7 @@ struct xt_entry_match { | |||
| 12 | __u16 match_size; | 13 | __u16 match_size; |
| 13 | 14 | ||
| 14 | /* Used by userspace */ | 15 | /* Used by userspace */ |
| 15 | char name[XT_FUNCTION_MAXNAMELEN-1]; | 16 | char name[XT_EXTENSION_MAXNAMELEN]; |
| 16 | |||
| 17 | __u8 revision; | 17 | __u8 revision; |
| 18 | } user; | 18 | } user; |
| 19 | struct { | 19 | struct { |
| @@ -36,8 +36,7 @@ struct xt_entry_target { | |||
| 36 | __u16 target_size; | 36 | __u16 target_size; |
| 37 | 37 | ||
| 38 | /* Used by userspace */ | 38 | /* Used by userspace */ |
| 39 | char name[XT_FUNCTION_MAXNAMELEN-1]; | 39 | char name[XT_EXTENSION_MAXNAMELEN]; |
| 40 | |||
| 41 | __u8 revision; | 40 | __u8 revision; |
| 42 | } user; | 41 | } user; |
| 43 | struct { | 42 | struct { |
| @@ -70,8 +69,7 @@ struct xt_standard_target { | |||
| 70 | /* The argument to IPT_SO_GET_REVISION_*. Returns highest revision | 69 | /* The argument to IPT_SO_GET_REVISION_*. Returns highest revision |
| 71 | * kernel supports, if >= revision. */ | 70 | * kernel supports, if >= revision. */ |
| 72 | struct xt_get_revision { | 71 | struct xt_get_revision { |
| 73 | char name[XT_FUNCTION_MAXNAMELEN-1]; | 72 | char name[XT_EXTENSION_MAXNAMELEN]; |
| 74 | |||
| 75 | __u8 revision; | 73 | __u8 revision; |
| 76 | }; | 74 | }; |
| 77 | 75 | ||
| @@ -291,7 +289,7 @@ struct xt_tgdtor_param { | |||
| 291 | struct xt_match { | 289 | struct xt_match { |
| 292 | struct list_head list; | 290 | struct list_head list; |
| 293 | 291 | ||
| 294 | const char name[XT_FUNCTION_MAXNAMELEN-1]; | 292 | const char name[XT_EXTENSION_MAXNAMELEN]; |
| 295 | u_int8_t revision; | 293 | u_int8_t revision; |
| 296 | 294 | ||
| 297 | /* Return true or false: return FALSE and set *hotdrop = 1 to | 295 | /* Return true or false: return FALSE and set *hotdrop = 1 to |
| @@ -330,7 +328,7 @@ struct xt_match { | |||
| 330 | struct xt_target { | 328 | struct xt_target { |
| 331 | struct list_head list; | 329 | struct list_head list; |
| 332 | 330 | ||
| 333 | const char name[XT_FUNCTION_MAXNAMELEN-1]; | 331 | const char name[XT_EXTENSION_MAXNAMELEN]; |
| 334 | u_int8_t revision; | 332 | u_int8_t revision; |
| 335 | 333 | ||
| 336 | /* Returns verdict. Argument order changed since 2.6.9, as this | 334 | /* Returns verdict. Argument order changed since 2.6.9, as this |
