rules: fixed leak/panic when parsing/loading lists

Rules of type lists [domains, IPs, network ranges] are reloaded
whenever a file containing the data changes.

One could expect to update these files once or twice a day, but
by updating the files continuously it was possible to cause a leak,
leading to a crash.
This commit is contained in:
Gustavo Iñiguez Goia
2022-01-26 21:12:16 +01:00
parent a936e8755a
commit 53419fe8bc
+3
View File
@@ -233,6 +233,9 @@ func (o *Operator) reListCmp(v interface{}) bool {
if o.Sensitive == false {
dstHost = strings.ToLower(dstHost)
}
o.RLock()
defer o.RUnlock()
for file, re := range o.lists {
r := re.(*regexp.Regexp)
if r.MatchString(dstHost) {