[iptables PATCH 01/17] xtables: Fix crash if nft_rule_list_get() fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Without this, trying to add a rule using ebtables without proper
permissions crashes the program.

Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 iptables/nft.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/iptables/nft.c b/iptables/nft.c
index 3cacf5feb317f..3e7c555778b1f 100644
--- a/iptables/nft.c
+++ b/iptables/nft.c
@@ -1176,7 +1176,10 @@ 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)) {
+		printf("nft_rule_list_get() failed!\n");
+		return 0;
+	}
 
 	nftnl_rule_list_add_tail(r, h->rule_cache);
 
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux