From 84054203afeb9f3c0ece9b85922bb357f9419d14 Mon Sep 17 00:00:00 2001 From: 1848 <> Date: Tue, 7 Aug 2018 21:30:25 +0200 Subject: [PATCH] Use fchmod instead of chmod for unix sockets to prevent TOCTTOU --- src/event/ServerSocket.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx index f9ec3104b..12576d2a2 100644 --- a/src/event/ServerSocket.cxx +++ b/src/event/ServerSocket.cxx @@ -188,10 +188,10 @@ OneServerSocket::Open() /* allow everybody to connect */ if (!path.IsNull()) - chmod(path.c_str(), 0666); + fchmod(_fd.Get(), 0666); #endif - /* register in the EventLoop */ + /* register in the EventLoop */ SetFD(_fd.Release()); }