From 55903a8d5e7f7051eae5fa2d224304f93ac03d55 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Fri, 24 Oct 2025 09:06:02 +0200 Subject: [PATCH] Fix Array out of bounds bug in build.func --- misc/build.func | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/misc/build.func b/misc/build.func index a7336f821..94a411158 100644 --- a/misc/build.func +++ b/misc/build.func @@ -3035,8 +3035,11 @@ create_lxc_container() { msg_debug "Found ${#LOCAL_TEMPLATES[@]} local templates, ${#ONLINE_TEMPLATES[@]} online templates" if [[ ${#ONLINE_TEMPLATES[@]} -gt 0 ]]; then msg_debug "First 3 online templates:" - for i in {0..2}; do - [[ -n "${ONLINE_TEMPLATES[$i]}" ]] && msg_debug " [$i]: ${ONLINE_TEMPLATES[$i]}" + count=0 + for idx in "${!ONLINE_TEMPLATES[@]}"; do + msg_debug " [$idx]: ${ONLINE_TEMPLATES[$idx]}" + ((count++)) + [[ $count -ge 3 ]] && break done fi msg_debug "ONLINE_TEMPLATE='$ONLINE_TEMPLATE'"