Skip to content

Commit 20c3da0

Browse files
committed
io/fileview: null watcher ptr after deletion to avoid UAF
Fixes #69
1 parent 8be18c0 commit 20c3da0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/io/fileview.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,10 @@ void FileView::updatePath() {
492492
void FileView::updateWatchedFiles() {
493493
// If inotify events are sent to the watcher after deletion and deleteLater
494494
// isn't used, a use after free in the QML engine will occur.
495-
if (this->watcher) this->watcher->deleteLater();
495+
if (this->watcher) {
496+
this->watcher->deleteLater();
497+
this->watcher = nullptr;
498+
}
496499

497500
if (!this->targetPath.isEmpty() && this->bWatchChanges) {
498501
qCDebug(logFileView) << "Creating watcher for" << this << "at" << this->targetPath;

0 commit comments

Comments
 (0)