Skip to contentSkip to conversation

evaluate: guard against NULL basetype

PATCH New Florian Westphal 1 participant 1 message Dec 4, 2023 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 evaluate: guard against NULL basetype

i->dtype->basetype can be NULL.

---
 src/evaluate.c                                               | 2 +-
 tests/shell/testcases/bogons/nft-f/no_integer_basetype_crash | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 tests/shell/testcases/bogons/nft-f/no_integer_basetype_crash
src/evaluate.c +1 -1
index b6428018c398..b6670254b9fd 100644
@@ -1610,7 +1610,7 @@ static int expr_evaluate_list(struct eval_ctx *ctx, struct expr **expr)
 			return expr_error(ctx->msgs, i,
 					  "List member must be a constant "
 					  "value");
-		if (i->dtype->basetype->type != TYPE_BITMASK)
+		if (datatype_basetype(i->dtype)->type != TYPE_BITMASK)
 			return expr_error(ctx->msgs, i,
 					  "Basetype of type %s is not bitmask",
 					  i->dtype->desc);
tests/shell/testcases/bogons/nft-f/no_integer_basetype_crash new file +1 -0
new file mode 100644
index 000000000000..16d3e41fcce9
@@ -0,0 +1 @@
+cPoR et ip dscp << 2>0 ,xl rt  ipsec   c0tt in  tabl rt  ipsec   cl
Signature · 1 line
2.41.0