aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-08-18 17:16:21 +0200
committerKim Alvefur <zash@zash.se>2016-08-18 17:16:21 +0200
commit7b734a63a00edba3fe499c6fedcf045dd27baf1e (patch)
tree2d7543d07a74d8008ac0b103696b1a7b3f025976
parent85891f31602f609c78ba53954358227371495b49 (diff)
downloadprosody-7b734a63a00edba3fe499c6fedcf045dd27baf1e.tar.gz
prosody-7b734a63a00edba3fe499c6fedcf045dd27baf1e.zip
net.server_epoll: Prevent invalid FDs from being added to epoll
-rw-r--r--net/server_epoll.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index e85947ae..7d279035 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -246,6 +246,10 @@ function interface:setflags(r, w)
return true;
end
local fd = self:getfd();
+ if fd < 0 then
+ self._wantread, self._wantwrite = nil, nil;
+ return nil, "invalid fd";
+ end
local op = "mod";
if not flags then
op = "del";