mirror of
https://github.com/coredns/coredns.git
synced 2026-01-14 21:01:19 -05:00
fix(plugins): add regex length limit (#7802)
This commit is contained in:
@@ -142,6 +142,9 @@ func newRCodeRule(nextAction string, args ...string) (Rule, error) {
|
||||
plugin.Name(args[1]).Normalize(),
|
||||
}, nil
|
||||
case RegexMatch:
|
||||
if len(args[1]) > maxRegexpLen {
|
||||
return nil, fmt.Errorf("regex pattern too long in a rcode rule: %d > %d", len(args[1]), maxRegexpLen)
|
||||
}
|
||||
regexPattern, err := regexp.Compile(args[1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid regex pattern in a rcode rule: %s", args[1])
|
||||
|
||||
Reference in New Issue
Block a user