From 0cbe60118eafe734de7369783cf1c92f6e0934f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Falgueras=20Garc=C3=ADa?= Date: Thu, 18 Aug 2016 17:12:36 +0200 Subject: rule: Fix comparison between rules if number of expressions differ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this patch, comparison between rules with distinct number of expressions indicate that they are equals, however, they are not. Example: r1[e1, e2] == r2[e1, e2, e3] Fix this by checking that the number of expression is the same. Reported-by: Pablo Neira Ayuso Signed-off-by: Carlos Falgueras GarcĂ­a Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/rule.c') diff --git a/src/rule.c b/src/rule.c index ae7c478..5d0097c 100644 --- a/src/rule.c +++ b/src/rule.c @@ -1102,6 +1102,7 @@ bool nftnl_rule_cmp(const struct nftnl_rule *r1, const struct nftnl_rule *r2) e1 = nftnl_expr_iter_next(&it1); e2 = nftnl_expr_iter_next(&it2); } + eq &= (!e1 && !e2); return eq; } -- cgit v1.2.3