File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,14 @@ ListeningSocket::ListeningSocket(ListeningSocket &&LS)
119
119
Expected<ListeningSocket> ListeningSocket::createUnix (StringRef SocketPath,
120
120
int MaxBacklog) {
121
121
122
+ // If SocketPath is too long, the path will be truncated, and there may be
123
+ // collisions with other truncated addresses that the fs::exists check below
124
+ // will be unable to detect.
125
+ if (SocketPath.size () >= sizeof (sockaddr_un::sun_path))
126
+ return llvm::make_error<StringError>(
127
+ std::make_error_code (std::errc::filename_too_long),
128
+ " SocketPath too long" );
129
+
122
130
// Handle instances where the target socket address already exists and
123
131
// differentiate between a preexisting file with and without a bound socket
124
132
//
You can’t perform that action at this time.
0 commit comments