payload: don't decode past last valid template
Florian Westphal
maintainerPATCH 1/1 payload: don't decode past last valid template
When trying to decode payload header fields, be sure to bail out when having exhausted all available templates.
Otherwise, we allocate invalid payload expressions (no dataype, header length of 0) and then crash when trying to print them.
Signed-off-by Florian Westphal <[email protected]>
--- src/payload.c | 4 ++++ 1 file changed, 4 insertions(+)
src/payload.c +4 -0
@@ -618,6 +618,10 @@ void payload_expr_expand(struct list_head *list, struct expr *expr,for (i =1 ; i <array_size (desc->templates); i++) { tmpl = &desc->templates[i]; + +if (tmpl->len ==0 ) +break ; +if (tmpl->offset != expr->payload.offset)continue ;
Signature · 1 line
2.16.1
Quoted 8 lines · Florian Westphal
When trying to decode payload header fields, be sure to bail out when having exhausted all available templates.
Otherwise, we allocate invalid payload expressions (no dataype, header length of 0) and then crash when trying to print them.