# HG changeset patch # User daurnimator # Date 1387407303 18000 # Node ID 936f969bf7835c02e70f8403cb6507bae6a153ec # Parent b1615fa62e59c8efccba9116fad2548bef1c3a9f net/server_select: addclient: Check arguments diff -r b1615fa62e59 -r 936f969bf783 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 @@ -943,6 +943,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