diff --git a/handler/routes.go b/handler/routes.go index 57fe67e..f418a61 100644 --- a/handler/routes.go +++ b/handler/routes.go @@ -280,7 +280,7 @@ func UpdateClient(db store.IStore) echo.HandlerFunc { return c.JSON(http.StatusBadRequest, jsonHTTPResponse{false, "Allowed IPs must be in CIDR format"}) } - if len(_client.ExtraAllowedIPs) > 0 && util.ValidateAllowedIPs(_client.ExtraAllowedIPs) == false { + if util.ValidateAllowedIPs(_client.ExtraAllowedIPs) == false { log.Warnf("Invalid Allowed IPs input from user: %v", _client.ExtraAllowedIPs) return c.JSON(http.StatusBadRequest, jsonHTTPResponse{false, "Extra Allowed IPs must be in CIDR format"}) } diff --git a/util/util.go b/util/util.go index 2269537..aad0c7b 100644 --- a/util/util.go +++ b/util/util.go @@ -78,8 +78,10 @@ func ValidateCIDR(cidr string) bool { // ValidateCIDRList to validate a list of network CIDR func ValidateCIDRList(cidrs []string) bool { for _, cidr := range cidrs { - if ValidateCIDR(cidr) == false { - return false + if len(cidr) > 0 { + if ValidateCIDR(cidr) == false { + return false + } } } return true