]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
disallow constant data for "switch"
authorAlan T. DeKok <aland@freeradius.org>
Tue, 6 Apr 2021 17:14:27 +0000 (13:14 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 6 Apr 2021 17:51:34 +0000 (13:51 -0400)
src/lib/unlang/compile.c

index c03d54375da920f0e04ae431a064757bc6dca3be..a8b7fafb72b26b51ea4a3fadb12dc3f22a33a7f6 100644 (file)
@@ -1974,6 +1974,12 @@ static unlang_t *compile_switch(unlang_t *parent, unlang_compile_t *unlang_ctx,
                return NULL;
        }
 
+       if (tmpl_is_data(gext->vpt)) {
+               cf_log_err(cs, "Cannot use constant data for 'switch' statement");
+               talloc_free(g);
+               return NULL;
+       }
+
        if (!tmpl_is_attr(gext->vpt)) (void) tmpl_cast_set(gext->vpt, FR_TYPE_STRING);
 
        /*