修复WAF提取正则表达式关键词时可能会使程序崩溃的Bug

This commit is contained in:
GoEdgeLab
2022-02-23 17:35:35 +08:00
parent 9c2e8593af
commit bfa0545fdc

View File

@@ -211,6 +211,9 @@ func (this *Regexp) parseKeyword(keyword []rune) (result []rune) {
}
if keyword[index-1] != '\\' {
if r == '{' && (braceZero.MatchString(string(keyword[index:])) || braceZero2.MatchString(string(keyword[index:]))) { // r {0, ...}
if len(result) == 0 {
return nil
}
return result[:len(result)-1]
}
@@ -221,6 +224,9 @@ func (this *Regexp) parseKeyword(keyword []rune) (result []rune) {
if index == 0 {
return nil
}
if len(result) == 0 {
return nil
}
return result[:len(result)-1]
}
if r == '\\' || r == '\b' {