]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Minor re-arrangement to pacify Coverity (CID #1596468)
authorNick Porter <nick@portercomputing.co.uk>
Thu, 18 Apr 2024 09:16:19 +0000 (10:16 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 18 Apr 2024 09:16:19 +0000 (10:16 +0100)
src/lib/unlang/call_env.c

index 681794912920f0aad1dd1ae374c56d1ee63e815e..57feccefa8ea234c026f6382ea3d7d7b86786783 100644 (file)
@@ -160,12 +160,17 @@ static unlang_action_t call_env_expand_start(UNUSED rlm_rcode_t *p_result, UNUSE
                         *      all expansions adjust the `out` pointer to write to.
                         */
                        if (call_env_multi(env->rule->flags)) {
-                               void *array;
+                               void **array;
                                if (env->multi_index == 0) {
-                                       MEM(array = talloc_zero_array((*call_env_rctx->data), void *, env->count));
+                                       /*
+                                        *      Coverity thinks talloc_zero_array being called with the type `void *`
+                                        *      is a size mismatch.  This works round the false positive.
+                                        */
+                                       MEM(array = _talloc_zero_array((*call_env_rctx->data), sizeof(uint8_t *),
+                                                                       env->count, "void *"));
                                        *out = array;
                                }
-                               array = *(void **)out;
+                               array = (void **)(*out);
                                out = (void **)((uint8_t *)array + sizeof(void *) * env->multi_index);
                        }