Merge pull request #541 from ShySec/master

goroutine references address overwritten in loop; pass-by-value instead
This commit is contained in:
evilsocket 2019-04-14 10:34:03 +03:00 committed by GitHub
commit 9aaa13b6f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,15 +112,15 @@ func (p *EventPool) Add(tag string, data interface{}) {
// broadcast the event to every listener
for _, l := range p.listeners {
// do not block!
go func(ch *chan Event) {
go func(ch chan Event) {
// channel might be closed
defer func() {
if recover() != nil {
}
}()
*ch <- e
}(&l)
ch <- e
}(l)
}
}