mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-25 17:21:54 -07:00
asyncDialogBox: lock box in fdWrite to prevent a uaf (#10759)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
SP<CAsyncDialogBox> CAsyncDialogBox::lockSelf() {
|
||||
return m_selfWeakReference.lock();
|
||||
}
|
||||
|
@@ -27,6 +27,8 @@ class CAsyncDialogBox {
|
||||
void kill();
|
||||
bool isRunning() const;
|
||||
|
||||
SP<CAsyncDialogBox> lockSelf();
|
||||
|
||||
// focus priority, only permission popups
|
||||
bool m_priority = false;
|
||||
|
||||
|
Reference in New Issue
Block a user