payload: return early if dependency is not a payload expression
Florian Westphal
maintainerPATCH 1/1 payload: return early if dependency is not a payload expression
if (dep->left->payload.base != PROTO_BASE_TRANSPORT_HDR)
is legal only after checking that ->left points to an EXPR_PAYLOAD expression. The dependency store can also contain EXPR_META, in this case we access a bogus part of the union.
The payload_may_dependency_kill_icmp helper can't handle a META dep either, so return early.
Signed-off-by Florian Westphal <[email protected]>
--- src/payload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/payload.c +2 -1
@@ -893,7 +893,8 @@ static bool payload_may_dependency_kill(struct payload_dep_ctx *ctx,if (expr->payload.base !=PROTO_BASE_TRANSPORT_HDR )return true; -if (dep->left->payload.base !=PROTO_BASE_TRANSPORT_HDR ) +if (dep->left->etype !=EXPR_PAYLOAD || + dep->left->payload.base !=PROTO_BASE_TRANSPORT_HDR )return true;if (dep->left->payload.desc == &proto_icmp)
Signature · 1 line
2.45.3
Quoted 8 lines · Florian Westphal
if (
dep->left->payload.base!=PROTO_BASE_TRANSPORT_HDR)is legal only after checking that ->left points to an
EXPR_PAYLOADexpression. The dependency store can also containEXPR_META, in this case we access a bogus part of the union.The
payload_may_dependency_kill_icmphelper can't handle a META dep either, so return early.
Fixes 533565244d88 ("payload: check icmp dependency before removing previous icmp expression")
Quoted 1 line
Signed-off-by Florian Westphal <[email protected]>
Reviewed-by Pablo Neira Ayuso <[email protected]>
Thanks.