]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: fix crash if nft_rule_list_get() fails
authorPhil Sutter <phil@nwl.cc>
Thu, 19 Jul 2018 16:31:53 +0000 (18:31 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 19 Jul 2018 20:10:20 +0000 (22:10 +0200)
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>
iptables/nft.c

index 3cacf5feb317fa39a8648ca2b145681a33d22b24..e1788dbadddd54842bef8cddebc2bf4c324fa57f 100644 (file)
@@ -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);