From: James Jones Date: Thu, 15 Feb 2024 17:45:19 +0000 (-0600) Subject: Don't pass NULL rules to call_env_alloc() (CID #1530398) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f31c319109c29abdd84da65a90cd30a54192758e;p=thirdparty%2Ffreeradius-server.git Don't pass NULL rules to call_env_alloc() (CID #1530398) 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(). --- diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index fcc54aa61b5..861dd4c7195 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -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);