]> git.ipfire.org Git - thirdparty/nftables.git/commit
parser_json: Fix for ineffective family value checks
authorPhil Sutter <phil@nwl.cc>
Fri, 12 Oct 2018 15:23:24 +0000 (17:23 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 15 Oct 2018 11:37:51 +0000 (13:37 +0200)
commitc7a5401943df8b6b96f6b5eedd9a1e0013e01d86
treed0a04171cfd7b241d07db380db674c0fdb1c7d10
parenta56fe55dbd3232e70514610a1c2df1d6b15b931f
parser_json: Fix for ineffective family value checks

Since handle->family is unsigned, checking for value < 0 never yields
true. Overcome this by changing parse_family() to return an error code
and write the parsed family value into a pointer passed as parameter.

The above change required a bit more cleanup to avoid passing pointers
to signed variables to the function. Also leverage json_parse_family() a
bit more to reduce code side.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/parser_json.c