Skip to content

Commit

Permalink
filterx: fix template evaluation
Browse files Browse the repository at this point in the history
FilterXEvalContext->template_eval_options was stored on an unrolled stack
location.

Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed May 7, 2024
1 parent a8443c8 commit c0eba5a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/filterx/expr-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ _eval(FilterXExpr *s)
/* FIXME/2: let's make this handle literal and trivial templates */

log_template_format_value_and_type_with_context(self->template, context->msgs, context->num_msg,
context->template_eval_options, value, &t);
&context->template_eval_options, value, &t);

/* NOTE: we borrow value->str here which is stored in a scratch buffer
* that should be valid as long as we are traversing the filter
Expand Down
2 changes: 1 addition & 1 deletion lib/filterx/filterx-eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ filterx_eval_init_context(FilterXEvalContext *context, FilterXEvalContext *previ
filterx_scope_make_writable(&scope);

memset(context, 0, sizeof(*context));
context->template_eval_options = &DEFAULT_TEMPLATE_EVAL_OPTIONS;
context->template_eval_options = DEFAULT_TEMPLATE_EVAL_OPTIONS;
context->scope = scope;

if (previous_context)
Expand Down
2 changes: 1 addition & 1 deletion lib/filterx/filterx-eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct _FilterXEvalContext
gint num_msg;
FilterXScope *scope;
FilterXError error;
LogTemplateEvalOptions *template_eval_options;
LogTemplateEvalOptions template_eval_options;
GPtrArray *weak_refs;
FilterXEvalContext *previous_context;
};
Expand Down

0 comments on commit c0eba5a

Please sign in to comment.