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
commit1d132becbc04010a2a7d25bef5097be25c036220 (patch)
tree2d7543d07a74d8008ac0b103696b1a7b3f025976
parent74534761b33e3da375f56bb4e0b2bf3ae40ff7d1 (diff)
downloadprosody-1d132becbc04010a2a7d25bef5097be25c036220.tar.gz
prosody-1d132becbc04010a2a7d25bef5097be25c036220.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";