diff --git a/providers/autodns/autoDnsProvider.go b/providers/autodns/autoDnsProvider.go index cb371a2f8..7682118c5 100644 --- a/providers/autodns/autoDnsProvider.go +++ b/providers/autodns/autoDnsProvider.go @@ -339,10 +339,22 @@ func toRecordConfig(domain string, record *ResourceRecord) *models.RecordConfig found := re.FindStringSubmatch(record.Value) weight, _ := strconv.Atoi(found[1]) - rc.SrvWeight = uint16(weight) + if weight < 0 { + rc.SrvWeight = 0 + } else if weight > 65535 { + rc.SrvWeight = 65535 + } else { + rc.SrvWeight = uint16(weight) + } port, _ := strconv.Atoi(found[2]) - rc.SrvPort = uint16(port) + if port < 0 { + rc.SrvPort = 0 + } else if port > 65535 { + rc.SrvPort = 65535 + } else { + rc.SrvPort = uint16(port) + } rc.SetTarget(found[3]) }