From 699816ddf2364878a0fb7698b5210ec7ebd2bf1b Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Tue, 3 Jun 2025 16:52:08 +0300 Subject: [PATCH] config-prepare: Initialize an empty KERNEL_DRIVERS_SKIP array unless it exists If the array exists in this location, initializing an empty array will destroy all the data that was stored in it. Do not initialize an empty KERNEL_DRIVERS_SKIP array if it exists. This allows us to create an array anywhere in the script, including the user configuration, in a secure way. --- lib/functions/main/config-prepare.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/functions/main/config-prepare.sh b/lib/functions/main/config-prepare.sh index 05573d493..1a3f1e521 100644 --- a/lib/functions/main/config-prepare.sh +++ b/lib/functions/main/config-prepare.sh @@ -166,7 +166,11 @@ function config_early_init() { display_alert "Starting single build process" "${BOARD:-"no BOARD set"}" "info" - declare -g -a KERNEL_DRIVERS_SKIP=() # Prepare array to be filled in by board/family/extensions + # Do not initialize an empty array if it exists. + if [ "${KERNEL_DRIVERS_SKIP[*]}" == "" ]; then + # Prepare array to be filled in by board/family/extensions + declare -g -a KERNEL_DRIVERS_SKIP=() + fi silent="yes" track_general_config_variables "after config_early_init" # don't log anything, just init the change tracking