Skip to content

Commit 6ba87a5

Browse files
authored
Don't read() from the invalid descriptor
Having the invalid value of descriptor here might be considered weird, but it happens nevertheless, when you're DoSing the websocket endpoint using the 3G connection. It makes sense to return the generic error here instead of trying to read() from it.
1 parent c5a02f1 commit 6ba87a5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ixwebsocket/IXSelectInterruptPipe.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ namespace ix
134134

135135
int fd = _fildes[kPipeReadIndex];
136136

137+
// A weird state has been reached (consider reporting to the error log?)
138+
if (-1 == fd) return std::numeric_limits<uint64_t>::max();
139+
137140
uint64_t value = 0;
138141

139142
ssize_t ret = -1;

0 commit comments

Comments
 (0)