From 1d132becbc04010a2a7d25bef5097be25c036220 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 18 Aug 2016 17:16:21 +0200 Subject: net.server_epoll: Prevent invalid FDs from being added to epoll --- net/server_epoll.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'net/server_epoll.lua') 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"; -- cgit v1.2.3