[android] Added port checking

This commit is contained in:
alexzatsepin 2016-10-17 13:27:16 +03:00
parent 88f688aeca
commit c23df895a7

View file

@ -45,6 +45,12 @@ class SocketWrapper implements PlatformSocket
return false;
}
if (!isPortAllowed(port))
{
sLogger.e("A wrong port number, it must be within (0-65535) range", port);
return false;
}
mHost = host;
mPort = port;
@ -57,6 +63,11 @@ class SocketWrapper implements PlatformSocket
return mSocket != null;
}
private static boolean isPortAllowed(int port)
{
return port >= 0 && port <= 65535;
}
@Nullable
private static Socket createSocket(@NonNull String host, int port, boolean ssl)
{