From 3f99e4892685ac4c7f1eade51285d2a7d9a8aff7 Mon Sep 17 00:00:00 2001 From: divinity76 Date: Mon, 7 Oct 2024 07:44:46 +0200 Subject: [PATCH] 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 --- func/main.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/func/main.sh b/func/main.sh index c9d4885667..c8765bdb1f 100644 --- a/func/main.sh +++ b/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 }