fix: Validate subnet mask (#1261)

This commit is contained in:
Kroese
2026-07-15 14:17:01 +02:00
committed by GitHub
parent 0cd08f2ee1
commit 9cf31df266
2 changed files with 9 additions and 2 deletions
+7 -2
View File
@@ -142,8 +142,8 @@ maskToCIDR() {
}
')
if [[ ! "$prefix" =~ ^[0-9]+$ ]] || (( prefix < 1 || prefix > 24 )); then
error "Invalid MASK: '$mask' (supported range: /1 through /24)"
if [[ ! "$prefix" =~ ^[0-9]+$ ]] || (( prefix < 0 || prefix > 32 )); then
error "Invalid MASK: '$mask'"
return 1
fi
@@ -1372,6 +1372,11 @@ validateMask() {
PREFIX=$(maskToCIDR "$MASK") || exit 28
if (( PREFIX < 1 || PREFIX > 24 )); then
error "Unsupported MASK: '$MASK' (supported range: /1 through /24)"
exit 28
fi
return 0
}
+2
View File
@@ -31,6 +31,8 @@ detectEngine() {
else
[ -z "$ENGINE" ] && ENGINE="Kubernetes"
fi
elif [ -f "/.dockerenv" ]; then
ENGINE="Docker"
fi
return 0