summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qsharedmemory_unix.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-12-22 08:32:12 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-18 07:05:19 +0100
commit20b26bdb3dd5e46b01b9a7e1ce8342074df3c89c (patch)
treeeb185bea4efd92b789c569e1038b5f4218fae321 /src/corelib/kernel/qsharedmemory_unix.cpp
parent0e8030bf479eb08bb718899f698a3f513eb36844 (diff)
Change all shmget calls to user-only memory
Drop the read and write permissions for group and other users in the system. Change-Id: I8fc753f09126651af3fb82df3049050f0b14e876 (cherry-picked from Qt 5 commit 856f209fb63ae336bfb389a12d2a75fa886dc1c5) Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/corelib/kernel/qsharedmemory_unix.cpp')
-rw-r--r--src/corelib/kernel/qsharedmemory_unix.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp
index 20d76e3530..4cf3acf08c 100644
--- a/src/corelib/kernel/qsharedmemory_unix.cpp
+++ b/src/corelib/kernel/qsharedmemory_unix.cpp
@@ -238,7 +238,7 @@ bool QSharedMemoryPrivate::create(int size)
}
// create
- if (-1 == shmget(unix_key, size, 0666 | IPC_CREAT | IPC_EXCL)) {
+ if (-1 == shmget(unix_key, size, 0600 | IPC_CREAT | IPC_EXCL)) {
QString function = QLatin1String("QSharedMemory::create");
switch (errno) {
case EINVAL:
@@ -293,7 +293,7 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode)
{
#ifndef QT_POSIX_IPC
// grab the shared memory segment id
- int id = shmget(unix_key, 0, (mode == QSharedMemory::ReadOnly ? 0444 : 0660));
+ int id = shmget(unix_key, 0, (mode == QSharedMemory::ReadOnly ? 0400 : 0600));
if (-1 == id) {
setErrorString(QLatin1String("QSharedMemory::attach (shmget)"));
return false;
@@ -381,7 +381,7 @@ bool QSharedMemoryPrivate::detach()
size = 0;
// Get the number of current attachments
- int id = shmget(unix_key, 0, 0444);
+ int id = shmget(unix_key, 0, 0400);
cleanHandle();
struct shmid_ds shmid_ds;