]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't pass NULL rules to call_env_alloc() (CID #1530398)
authorJames Jones <jejones3141@gmail.com>
Thu, 15 Feb 2024 17:45:19 +0000 (11:45 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Mar 2024 16:59:13 +0000 (10:59 -0600)
Coverity sees the nonnull attribute of call_env_alloc()'s t_rules
attribute, which compile_module() passes unlang_ctx->rules to.
Earlier unlang_ctx->rules is checked, so Coverity infers it can be
NULL and complains about the lack of checking on the call_env_alloc().

src/lib/unlang/compile.c

index fcc54aa61b59627e05d10a21629a5efacc6718c7..861dd4c71957bb421a7d96e78792e272f339ba41 100644 (file)
@@ -4581,6 +4581,10 @@ static unlang_t *compile_module(unlang_t *parent, unlang_compile_t *unlang_ctx,
                              "but no inst_size set",
                              inst->module->name, unlang_ctx->section_name1, unlang_ctx->section_name2);
 
+               if (!unlang_ctx->rules) {
+                       cf_log_err(ci, "Failed compiling %s - no rules", inst->module->name);
+                       goto error;
+               }
                single->call_env = call_env_alloc(single, single->self.name, method_env,
                                                  unlang_ctx->rules,
                                                  inst->dl_inst->conf, single->instance->dl_inst->data);