summaryrefslogtreecommitdiff
path: root/src/helpers/AsyncDialogBox.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-06-16 17:02:08 +0200
committerGitHub <noreply@github.com>2025-06-16 17:02:08 +0200
commitaba2cfe7a8d5c1658fe8df0095a089cc73db43ab (patch)
treed59eb8149d60838b6602942d0447fdfbec93b8f4 /src/helpers/AsyncDialogBox.cpp
parentd4e8a440874bebed07a5908009a3d854120277ed (diff)
asyncDialogBox: lock box in fdWrite to prevent a uaf (#10759)
Diffstat (limited to 'src/helpers/AsyncDialogBox.cpp')
-rw-r--r--src/helpers/AsyncDialogBox.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/helpers/AsyncDialogBox.cpp b/src/helpers/AsyncDialogBox.cpp
index 697d61ba..4ee5ccca 100644
--- a/src/helpers/AsyncDialogBox.cpp
+++ b/src/helpers/AsyncDialogBox.cpp
@@ -46,6 +46,9 @@ CAsyncDialogBox::CAsyncDialogBox(const std::string& title, const std::string& de
static int onFdWrite(int fd, uint32_t mask, void* data) {
auto box = (CAsyncDialogBox*)data;
+ // lock the box to prevent a UAF
+ auto lock = box->lockSelf();
+
box->onWrite(fd, mask);
return 0;
@@ -142,4 +145,8 @@ void CAsyncDialogBox::kill() {
bool CAsyncDialogBox::isRunning() const {
return m_readEventSource;
-} \ No newline at end of file
+}
+
+SP<CAsyncDialogBox> CAsyncDialogBox::lockSelf() {
+ return m_selfWeakReference.lock();
+}