From: Alan T. DeKok Date: Wed, 14 Sep 2022 01:47:13 +0000 (-0400) Subject: minor rearrangement X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8e7559832afe85eca4246ac08c3870ef2d01fc7;p=thirdparty%2Ffreeradius-server.git minor rearrangement we should check for bad LHS before parsing the RHS --- diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index dbc13d3a42a..e282b8cb972 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -1535,6 +1535,15 @@ static unlang_t *compile_edit_section(unlang_t *parent, unlang_compile_t *unlang return NULL; } + /* + * Can't assign to [*] or [#] + */ + num = tmpl_num(map->lhs); + if ((num == NUM_ALL) || (num == NUM_COUNT)) { + cf_log_err(cs, "Invalid array reference in %s", name); + goto fail; + } + /* * If the DA isn't structural, then it can't have children. */ @@ -1551,16 +1560,6 @@ static unlang_t *compile_edit_section(unlang_t *parent, unlang_compile_t *unlang goto fail; } } - - /* - * Can't assign to [*] or [#] - */ - num = tmpl_num(map->lhs); - if ((num == NUM_ALL) || (num == NUM_COUNT)) { - cf_log_err(cs, "Invalid array reference in %s", name); - goto fail; - } - /* * Do basic sanity checks and resolving. */