From 7027320a8f09d5047c7349635eca7c41bcfe2aec Mon Sep 17 00:00:00 2001 From: likzn <1020193211@qq.com> Date: Wed, 4 May 2022 00:46:49 +0800 Subject: [PATCH] fix(install.sh):fix arr out of bounds --- install.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/install.sh b/install.sh index bf517851..7d8ac90c 100755 --- a/install.sh +++ b/install.sh @@ -75,6 +75,21 @@ function vercomp() { then max_len=$len2 fi + + #pad right in short arr + if [[ len1 -gt len2 ]]; + then + for ((i = len2; i < len1; i++)); + do + v2[$i]=0 + done + else + for ((i = len1; i < len2; i++)); + do + v1[$i]=0 + done + fi + for i in `seq 0 $max_len` do # Fill empty fields with zeros in v1