Check if VPN IP/DNS address is numeric

This commit is contained in:
M66B 2016-02-27 09:17:44 +01:00
parent 4c8058b240
commit e4c63e0355
1 changed files with 2 additions and 0 deletions

View File

@ -650,6 +650,8 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
private void checkAddress(String address) throws IllegalArgumentException, UnknownHostException {
if (address == null || TextUtils.isEmpty(address.trim()))
throw new IllegalArgumentException("Bad address");
if (!Util.isNumericAddress(address))
throw new IllegalArgumentException("Bad address");
InetAddress idns = InetAddress.getByName(address);
if (idns.isLoopbackAddress() || idns.isAnyLocalAddress())
throw new IllegalArgumentException("Bad address");