]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
libxtables: xtoptions: Prevent XTOPT_PUT with XTTYPE_HOSTMASK
authorPhil Sutter <phil@nwl.cc>
Sun, 17 Dec 2023 12:02:36 +0000 (13:02 +0100)
committerPhil Sutter <phil@nwl.cc>
Wed, 10 Jan 2024 15:05:16 +0000 (16:05 +0100)
Do as the comment in xtopt_parse_hostmask() claims and omit
XTTYPE_HOSTMASK from xtopt_psize array so xtables_option_metavalidate()
will catch the incompatibility.

Fixes: 66266abd17adc ("libxtables: XTTYPE_HOSTMASK support")
include/xtables.h
libxtables/xtoptions.c

index b3c45c981b1c7153619e6ebf01d347404f5f140d..db7c492a9556e137387e137a0f552c9f8dbc0caf 100644 (file)
@@ -61,7 +61,6 @@ struct in_addr;
  * %XTTYPE_SYSLOGLEVEL:        syslog level by name or number
  * %XTTYPE_HOST:       one host or address (ptr: union nf_inet_addr)
  * %XTTYPE_HOSTMASK:   one host or address, with an optional prefix length
- *                     (ptr: union nf_inet_addr; only host portion is stored)
  * %XTTYPE_PROTOCOL:   protocol number/name from /etc/protocols (ptr: uint8_t)
  * %XTTYPE_PORT:       16-bit port name or number (supports %XTOPT_NBO)
  * %XTTYPE_PORTRC:     colon-separated port range (names acceptable),
index 5964a9bfb57fef34b1e899e47bc2de744280eda4..96946391880063c8859a0787f0d3e4e443cb364b 100644 (file)
@@ -57,7 +57,6 @@ static const size_t xtopt_psize[] = {
        [XTTYPE_STRING]      = -1,
        [XTTYPE_SYSLOGLEVEL] = sizeof(uint8_t),
        [XTTYPE_HOST]        = sizeof(union nf_inet_addr),
-       [XTTYPE_HOSTMASK]    = sizeof(union nf_inet_addr),
        [XTTYPE_PROTOCOL]    = sizeof(uint8_t),
        [XTTYPE_PORT]        = sizeof(uint16_t),
        [XTTYPE_PORTRC]      = sizeof(uint16_t[2]),