mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix nullptr dereference in IPC::isCurrentOwner
It would only trigger when multiple instances where running in parallel, with one having enough privilege to block the other from accessing the shared memory (e.g. root)
This commit is contained in:
parent
9dedd22bb2
commit
66314bc38d
10
src/ipc.cpp
10
src/ipc.cpp
|
@ -134,8 +134,14 @@ bool IPC::isCurrentOwner()
|
||||||
{
|
{
|
||||||
if (globalMemory.lock())
|
if (globalMemory.lock())
|
||||||
{
|
{
|
||||||
/// TODO: Segfault on exit on "mov rdx,QWORD PTR [rax]" w/ rax=0.
|
void* data = globalMemory.data();
|
||||||
bool isOwner = ((*(uint64_t*)globalMemory.data()) == globalId);
|
if (!data)
|
||||||
|
{
|
||||||
|
qWarning() << "IPC: isCurrentOwner failed to access the memory, returning false";
|
||||||
|
globalMemory.unlock();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool isOwner = ((*(uint64_t*)data) == globalId);
|
||||||
globalMemory.unlock();
|
globalMemory.unlock();
|
||||||
return isOwner;
|
return isOwner;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user