summaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
authorlikzn <1020193211@qq.com>2022-05-04 00:46:49 +0800
committerlikzn <1020193211@qq.com>2022-05-04 00:46:49 +0800
commit7027320a8f09d5047c7349635eca7c41bcfe2aec (patch)
treee58880697caf0b92dcc65eb7c133e8a7dc85f03f /install.sh
parentb759ef6b58ebb0687d5602f0721ec4a7e2f549ce (diff)
fix(install.sh):fix arr out of bounds
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/install.sh b/install.sh
index bf51785..7d8ac90 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