]> git.ipfire.org Git - thirdparty/nftables.git/commit
datatype: validate port number in inet_service_type_parse
authorPhil Oester <kernel@linuxace.com>
Thu, 15 Aug 2013 17:19:11 +0000 (10:19 -0700)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 17 Aug 2013 09:47:56 +0000 (11:47 +0200)
commit5075879c3370f7d070b40c2f1c8e8039a187d046
treee39378d115e0b377fb305582f4451e1755fe7db5
parentd0218ea4573837d775c3e605913a45021f1526b9
datatype: validate port number in inet_service_type_parse

At present, nft accepts out of range port values such as in this example:

    nft add rule ip filter input tcp dport 123456 accept

Attached patch adds checks for both integer overflow and 16 bit overflow,
and avoids getaddrinfo call in the (common) case of digit input. Example
above now produces this output:

    <cmdline>:1:36-41: Error: Service out of range
    add rule ip filter input tcp dport 123456 accept
                                       ^^^^^^
Signed-off-by: Phil Oester <kernel@linuxace.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/datatype.c