diff --git a/src/common/server.c b/src/common/server.c index f90ce28f..c2965eb3 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1559,7 +1559,7 @@ server_connect (server *serv, char *hostname, int port, int no_login) if (!hostname[0]) return; - if (port < 0) + if (port < 1 || port > 65535) { /* use default port for this server type */ port = 6667; @@ -1568,7 +1568,6 @@ server_connect (server *serv, char *hostname, int port, int no_login) port = 6697; #endif } - port &= 0xffff; /* wrap around */ if (serv->connected || serv->connecting || serv->recondelay_tag) server_disconnect (sess, TRUE, -1);