mirror of
https://github.com/coredns/coredns.git
synced 2026-01-18 14:51:18 -05:00
fix(plugins): add regex length limit (#7802)
This commit is contained in:
@@ -144,6 +144,9 @@ func newCNAMERule(nextAction string, args ...string) (Rule, error) {
|
||||
Upstream: upstream.New(),
|
||||
}
|
||||
if rewriteType == RegexMatch {
|
||||
if len(paramFromTarget) > maxRegexpLen {
|
||||
return nil, fmt.Errorf("regex pattern too long in a cname rule: %d > %d", len(paramFromTarget), maxRegexpLen)
|
||||
}
|
||||
re, err := regexp.Compile(paramFromTarget)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid cname rewrite regex pattern: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user