From: Alan T. DeKok Date: Mon, 28 Aug 2023 00:51:25 +0000 (-0400) Subject: inst->xlat may not exist in some circumstances X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e45f4984d02375564c460fb895eada33fc5190c;p=thirdparty%2Ffreeradius-server.git inst->xlat may not exist in some circumstances --- diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index c83492f2880..719bf77c466 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -1428,12 +1428,16 @@ static xlat_arg_parser_t const xlat_func_exists_arg[] = { /* * We just print the xlat as-is. */ -static fr_slen_t xlat_expr_print_exists(fr_sbuff_t *out, UNUSED xlat_exp_t const *node, void *instance, fr_sbuff_escape_rules_t const *e_rules) +static fr_slen_t xlat_expr_print_exists(fr_sbuff_t *out, xlat_exp_t const *node, void *instance, fr_sbuff_escape_rules_t const *e_rules) { - size_t at_in = fr_sbuff_used_total(out); + size_t at_in = fr_sbuff_used_total(out); xlat_exists_inst_t *inst = instance; - xlat_print(out, inst->xlat, e_rules); + if (inst->xlat) { + xlat_print(out, inst->xlat, e_rules); + } else { + xlat_print_node(out, node->call.args, xlat_exp_head(node->call.args), e_rules); + } return fr_sbuff_used_total(out) - at_in; }