summaryrefslogtreecommitdiffstats
path: root/iptables/nft.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-07-19 18:31:53 +0200
committerFlorian Westphal <fw@strlen.de>2018-07-19 22:10:20 +0200
commit907da5c505b219537586f7c2bdb7320c4f97386f (patch)
treed1b1521f13c7dba8ef3db80bfec17e8e9f0441f1 /iptables/nft.c
parent565a22395c4c620bf26a002515d9016db0c35824 (diff)
xtables: fix crash if nft_rule_list_get() fails
Without this, trying to add a rule using ebtables without proper permissions crashes the program. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/nft.c')
-rw-r--r--iptables/nft.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/iptables/nft.c b/iptables/nft.c
index 3cacf5fe..e1788dba 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -1176,7 +1176,8 @@ nft_rule_append(struct nft_handle *h, const char *chain, const char *table,
if (batch_rule_add(h, type, r) < 0)
nftnl_rule_free(r);
- nft_rule_list_get(h);
+ if (!nft_rule_list_get(h))
+ return 0;
nftnl_rule_list_add_tail(r, h->rule_cache);