summaryrefslogtreecommitdiff
path: root/Kernel/Net/LocalSocket.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-23 15:35:20 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-23 16:45:05 +0100
commitc32176db278ccb491475840c46fbdb9fdd21f4ee (patch)
treedce35b83aa87e8f41a543075223f93ad2278af43 /Kernel/Net/LocalSocket.cpp
parentf2ea6c3d4c32c0a6ed160980bf19219d64ddccab (diff)
downloadserenity-c32176db278ccb491475840c46fbdb9fdd21f4ee.zip
Kernel: Don't preserve set-uid bit in open() and bind() modes
For some reason we were keeping the bits 04777 in file modes. That doesn't seem right and I can't think of a reason why the set-uid bit should be allowed to slip through.
Diffstat (limited to 'Kernel/Net/LocalSocket.cpp')
-rw-r--r--Kernel/Net/LocalSocket.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp
index 4ad67b810c..0b3ffd9cb6 100644
--- a/Kernel/Net/LocalSocket.cpp
+++ b/Kernel/Net/LocalSocket.cpp
@@ -114,7 +114,7 @@ KResult LocalSocket::bind(Userspace<const sockaddr*> user_address, socklen_t add
dbgln<debug_local_socket>("LocalSocket({}) bind({})", this, path);
- mode_t mode = S_IFSOCK | (m_prebind_mode & 04777);
+ mode_t mode = S_IFSOCK | (m_prebind_mode & 0777);
UidAndGid owner { m_prebind_uid, m_prebind_gid };
auto result = VFS::the().open(path, O_CREAT | O_EXCL | O_NOFOLLOW_NOERROR, mode, Process::current()->current_directory(), owner);
if (result.is_error()) {
@@ -411,7 +411,7 @@ KResult LocalSocket::chmod(FileDescription&, mode_t mode)
if (m_file)
return m_file->chmod(mode);
- m_prebind_mode = mode & 04777;
+ m_prebind_mode = mode & 0777;
return KSuccess;
}