Skip to content

Commit 5a8fa80

Browse files
author
Martin Rohrmeier
authored
fix(security): fix file system race condition (#288)
1 parent 8e4307d commit 5a8fa80

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/documentation/Release.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ import dirTree from 'directory-tree'
2222

2323
class MDHelper {
2424
readContent(path) {
25-
if (!fs.lstatSync(path).isFile()) return ''
2625
try {
2726
const fd = fs.openSync(path, 'r')
27+
if (!fs.lstatSync(fd).isFile()) {
28+
return ''
29+
}
2830
return fs.existsSync(fd) ? fs.readFileSync(fd, 'utf8') : ''
2931
} catch (err) {
3032
return ''

0 commit comments

Comments
 (0)