mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-05 00:34:01 +08:00
修复WAF提取正则表达式关键词时可能会使程序崩溃的Bug
This commit is contained in:
@@ -211,6 +211,9 @@ func (this *Regexp) parseKeyword(keyword []rune) (result []rune) {
|
|||||||
}
|
}
|
||||||
if keyword[index-1] != '\\' {
|
if keyword[index-1] != '\\' {
|
||||||
if r == '{' && (braceZero.MatchString(string(keyword[index:])) || braceZero2.MatchString(string(keyword[index:]))) { // r {0, ...}
|
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]
|
return result[:len(result)-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,6 +224,9 @@ func (this *Regexp) parseKeyword(keyword []rune) (result []rune) {
|
|||||||
if index == 0 {
|
if index == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if len(result) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return result[:len(result)-1]
|
return result[:len(result)-1]
|
||||||
}
|
}
|
||||||
if r == '\\' || r == '\b' {
|
if r == '\\' || r == '\b' {
|
||||||
|
|||||||
Reference in New Issue
Block a user