mirror of
https://github.com/evilsocket/opensnitch.git
synced 2026-06-08 20:27:34 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user