From: Alan T. DeKok Date: Sun, 1 Oct 2023 14:26:11 +0000 (-0400) Subject: be more careful about parsing %{1} X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d98e83726a2bb9c351d529ebd8fbbfd7d8c5c6d9;p=thirdparty%2Ffreeradius-server.git be more careful about parsing %{1} --- diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index 99633070714..e06ad3f5bd9 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -956,17 +956,23 @@ int xlat_tokenize_expansion(xlat_exp_head_t *head, fr_sbuff_t *in, } #ifdef HAVE_REGEX + fr_sbuff_marker(&s_m, in); + len = fr_sbuff_adv_past_allowed(in, SIZE_MAX, sbuff_char_class_uint, NULL); + /* * Handle regex's %{} specially. But '3GPP-Foo' is an attribute. :( */ - if (fr_sbuff_is_digit(in)) { + if (len && fr_sbuff_is_char(in, '}')) { int ret; + fr_sbuff_set(in, &s_m); /* backtrack */ ret = xlat_tokenize_regex(head, in); if (ret <= 0) return ret; /* ret==1 means "nope, it's an attribute" */ } + fr_sbuff_set(in, &s_m); /* backtrack */ + #endif /* HAVE_REGEX */ /*