Message ID | 20170706142528.19715-1-phil@nwl.cc |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
On Thu, Jul 06, 2017 at 04:25:28PM +0200, Phil Sutter wrote: > Instead of returning the result of mpz_cmp(), this function returned 1 > unless both elements were equal and the first one had > EXPR_F_INTERVAL_END set. > Fixes: 0e5f289df9080 ("segtree: handle adjacent interval nodes from expr_value_cmp()") Sorry for the mess. :( -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/src/segtree.c b/src/segtree.c index a2316a7b98041..f53536210018d 100644 --- a/src/segtree.c +++ b/src/segtree.c @@ -602,10 +602,12 @@ static int expr_value_cmp(const void *p1, const void *p2) int ret; ret = mpz_cmp(expr_value(e1)->value, expr_value(e2)->value); - if (ret == 0 && (e1->flags & EXPR_F_INTERVAL_END)) - return -1; - else - return 1; + if (ret == 0) { + if (e1->flags & EXPR_F_INTERVAL_END) + return -1; + else if (e2->flags & EXPR_F_INTERVAL_END) + return 1; + } return ret; }
Instead of returning the result of mpz_cmp(), this function returned 1 unless both elements were equal and the first one had EXPR_F_INTERVAL_END set. Signed-off-by: Phil Sutter <phil@nwl.cc> --- src/segtree.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)