From: Alan T. DeKok Date: Mon, 25 May 2026 17:28:56 +0000 (-0400) Subject: more stringent checks on references X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a2d01cf9a2eb0eaf0b6551727ff6f5334f9ffda;p=thirdparty%2Ffreeradius-server.git more stringent checks on references we can't refer to any parent, otherwise we end up copying ourselves --- diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index 76f001b7bb3..f15dcd15946 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -366,15 +366,16 @@ char const *cf_expand_variables(char const *cf, int lineno, } else if (ci->type == CONF_ITEM_SECTION) { CONF_SECTION *subcs; + CONF_ITEM *ci_p; /* - * Adding an entry again to a - * section is wrong. We don't - * want an infinite loop. + * We can't refer to any parent, otherwise we have an infinite loop. */ - if (cf_item_to_section(ci->parent) == outer_cs) { - ERROR("%s[%d]: Cannot reference different item in same section", cf, lineno); - return NULL; + for (ci_p = &outer_cs->item; ci_p != NULL; ci_p = ci_p->parent) { + if (ci_p == ci) { + ERROR("%s[%d]: Cannot reference different item in same section", cf, lineno); + return NULL; + } } /*