]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
minor rearrangement
authorAlan T. DeKok <aland@freeradius.org>
Wed, 14 Sep 2022 01:47:13 +0000 (21:47 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 14 Sep 2022 02:07:05 +0000 (22:07 -0400)
we should check for bad LHS before parsing the RHS

src/lib/unlang/compile.c

index dbc13d3a42a5f74d152f6f709c81ea4b27ab8924..e282b8cb972d4e21e1872f53940aa932230a7f79 100644 (file)
@@ -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.
         */