andreaskoch / go-fswatch

fswatch is a go library for monitoring filesystem changes that does not depend on inotify
Other
57 stars 9 forks source link

Insecure increment of numberOfFileWatchers & numberOfFolderWatchers++ #6

Open luedigernet opened 7 years ago

luedigernet commented 7 years ago

Hi the increments should be surrounded with an Mutex to synchronize the write access to the variable. Because of concurrent go routines.

go-fswatch/file.go: 87
88 // increment watcher count 89: numberOfFileWatchers++ 90
91 var modTime time.Time

go-fswatch/folder.go: 119
120 // increment watcher count 121: numberOfFolderWatchers++ 122
123 for folderWatcher.wasStopped == false {