From: Kevin Day Date: Sun, 10 Aug 2025 01:43:02 +0000 (-0500) Subject: Security: Controller thread cleanup needs to check that used < size in array. X-Git-Tag: 0.7.3~37 X-Git-Url: https://www.git.kevux.org/?a=commitdiff_plain;h=62183e5fe6ce78d9968f5cf90d0fb19ffc6a0da7;p=controller Security: Controller thread cleanup needs to check that used < size in array. --- diff --git a/sources/c/program/controller/main/thread/cleanup.c b/sources/c/program/controller/main/thread/cleanup.c index 09468d6..7f032b3 100644 --- a/sources/c/program/controller/main/thread/cleanup.c +++ b/sources/c/program/controller/main/thread/cleanup.c @@ -180,8 +180,8 @@ extern "C" { f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &instance->stack.array, &instance->stack.used, &instance->stack.size); // Shrink the childs array. - if (instance->childs.used) { - for (; instance->childs.used && controller_thread_enable_get(&main->thread) == controller_thread_enable_e; --instance->childs.used) { + if (instance->childs.used && instance->childs.used < instance->childs.size) { + for (; instance->childs.used && instance->childs.used < instance->childs.size && controller_thread_enable_get(&main->thread) == controller_thread_enable_e; --instance->childs.used) { if (instance->childs.array[instance->childs.used]) break; } // for