[PATCH nft] evaluate: guard against NULL basetype

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i->dtype->basetype can be NULL.

Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 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

diff --git a/src/evaluate.c b/src/evaluate.c
index b6428018c398..b6670254b9fd 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -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);
diff --git a/tests/shell/testcases/bogons/nft-f/no_integer_basetype_crash b/tests/shell/testcases/bogons/nft-f/no_integer_basetype_crash
new file mode 100644
index 000000000000..16d3e41fcce9
--- /dev/null
+++ b/tests/shell/testcases/bogons/nft-f/no_integer_basetype_crash
@@ -0,0 +1 @@
+cPoR et ip dscp << 2>0 ,xl rt  ipsec   c0tt in  tabl rt  ipsec   cl
-- 
2.41.0





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux