# HG changeset patch # User daurnimator # Date 1387407303 18000 # Node ID 2a6edd4678c50dcf642382155c6d2098ee6cbf86 # Parent 9e3b15199ec53a0575bc32016ed2270976cd5f9c net/server_select: addclient: Check arguments diff -r 9e3b15199ec5 -r 2a6edd4678c5 net/server_select.lua --- a/net/server_select.lua Wed Dec 18 17:54:31 2013 -0500 +++ b/net/server_select.lua Wed Dec 18 17:55:03 2013 -0500 @@ -931,6 +931,21 @@ end local addclient = function( address, port, listeners, pattern, sslctx ) + local err + if type( listeners ) ~= "table" then + err = "invalid listener table" + elseif type ( addr ) ~= "string" then + err = "invalid address" + elseif type( port ) ~= "number" or not ( port >= 0 and port <= 65535 ) then + err = "invalid port" + elseif sslctx and not has_luasec then + err = "luasec not found" + end + if err then + out_error( "server.lua, addclient: ", err ) + return nil, err + end + local client, err = luasocket.tcp( ) if err then return nil, err