From fb047af1b8ae43cbc6134cf20855c8791bd112ee Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Tue, 6 Apr 2021 13:14:27 -0400 Subject: [PATCH] disallow constant data for "switch" --- src/lib/unlang/compile.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index c03d54375d..a8b7fafb72 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -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); /* -- 2.47.2