Fix a crash in rewrite plugin when rule type is missing (#5459)

This commit is contained in:
Yong Tang
2022-06-25 09:17:35 -07:00
committed by GitHub
parent 497c31f098
commit 4a40e9e3a0
2 changed files with 35 additions and 47 deletions

View File

@@ -104,6 +104,9 @@ func newRule(args ...string) (Rule, error) {
expectNumArgs = len(args) - 1
startArg = 2
case Stop:
if len(args) < 2 {
return nil, fmt.Errorf("stop rule must begin with a rule type")
}
ruleType = strings.ToLower(args[1])
expectNumArgs = len(args) - 1
startArg = 2