From: Carlos Falgueras García Date: Thu, 18 Aug 2016 15:12:36 +0000 (+0200) Subject: rule: Fix comparison between rules if number of expressions differ X-Git-Tag: libnftnl-1.0.7~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cbe60118eafe734de7369783cf1c92f6e0934f1;p=thirdparty%2Flibnftnl.git rule: Fix comparison between rules if number of expressions differ 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 --- diff --git a/src/rule.c b/src/rule.c index ae7c478d..5d0097ce 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; }