forked from organicmaps/organicmaps
[android] Added port checking
This commit is contained in:
parent
88f688aeca
commit
c23df895a7
1 changed files with 11 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue