]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: netlink_delinearize: don't assume element contains a value
authorFlorian Westphal <fw@strlen.de>
Thu, 11 Jan 2018 15:30:21 +0000 (16:30 +0100)
committerFlorian Westphal <fw@strlen.de>
Fri, 16 Mar 2018 23:32:41 +0000 (00:32 +0100)
We cannot assume i->key->key is EXPR_VALUE, we could look e.g.  at a range,
which will trigger an assertion failure in binop_adjust_one().

We should call __binop_adjust recursively again in the EXPR_SET_ELEM case,
using key as new input.

Fixes: b8b8e7b6ae10 ("evaluate: transfer right shifts to set reference side")
Signed-off-by: Florian Westphal <fw@strlen.de>
src/netlink_delinearize.c

index 997fb53b94997a3cc9f2e88b83644a4b9c007e97..b20047f14b55e772ac103902edfd46426840b1d4 100644 (file)
@@ -1648,7 +1648,7 @@ static void __binop_adjust(const struct expr *binop, struct expr *right,
                                binop_adjust_one(binop, i->key->right, shift);
                                break;
                        case EXPR_SET_ELEM:
-                               binop_adjust_one(binop, i->key->key, shift);
+                               __binop_adjust(binop, i->key->key, shift);
                                break;
                        default:
                                BUG("unknown expression type %s\n", i->key->ops->name);