Просмотр исходного кода

stricter validation (#4586)

* stricter validation

reject nonsense quotas like "0%" and "09%" and "199%"

mostly just a nitpick

* oops forgot a line

* Update main.sh
divinity76 1 год назад
Родитель
Сommit
3f99e48926
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      func/main.sh

+ 3 - 2
func/main.sh

@@ -1161,8 +1161,9 @@ is_cron_format_valid() {
 
 # Validate CPU Quota:
 is_valid_cpu_quota() {
-	if [[ ! "$1" =~ ^[0-9]+%$ ]]; then
-		check_result "$E_INVALID" "Invalid CPU Quota format :: $1"
+	local cpu_quota="$1"
+	if [[ ! "$cpu_quota" =~ ^[1-9][0-9]*%$ ]]; then
+		check_result "$E_INVALID" "Invalid CPU Quota format: $cpu_quota"
 	fi
 }