From: Kevin Day Date: Sat, 1 Jun 2024 22:06:59 +0000 (-0500) Subject: Security: Wrong sizeof() type used in controller allocation functions. X-Git-Tag: 0.6.11~57 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=c85e0e6892da72b0737fde2cd8302b0505a9b12f;p=fll Security: Wrong sizeof() type used in controller allocation functions. The controller_pids_resize() should be using pid_t instead of controller_rule_t. The processs is an aray of controller_process_t pointers. --- diff --git a/level_3/controller/c/common/private-process.c b/level_3/controller/c/common/private-process.c index aa70c85..9d9d742 100644 --- a/level_3/controller/c/common/private-process.c +++ b/level_3/controller/c/common/private-process.c @@ -29,7 +29,7 @@ extern "C" { #ifndef _di_controller_pids_resize_ f_status_t controller_pids_resize(const f_array_length_t length, controller_pids_t * const pids) { - const f_status_t status = f_memory_resize(pids->size, length, sizeof(controller_rule_t), (void **) & pids->array); + const f_status_t status = f_memory_resize(pids->size, length, sizeof(pid_t), (void **) & pids->array); if (F_status_is_error(status)) return status; pids->size = length; @@ -106,7 +106,7 @@ extern "C" { if (processs->array[i]) { controller_process_delete_simple(processs->array[i]); - f_memory_delete(1, sizeof(f_array_length_t *), (void **) & processs->array[i]); + f_memory_delete(1, sizeof(controller_process_t *), (void **) & processs->array[i]); } } // for @@ -119,7 +119,7 @@ extern "C" { // The lock must be initialized, but only once, so initialize immediately upon allocation. for (; processs->size < length; ++processs->size) { - status = f_memory_new(1, sizeof(controller_process_t), (void **) &processs->array[processs->size]); + status = f_memory_new(1, sizeof(controller_process_t *), (void **) &processs->array[processs->size]); if (F_status_is_error_not(status)) { process = processs->array[processs->size];