mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-25 07:32:46 +00:00
Check if VPN IP/DNS address is numeric
This commit is contained in:
parent
4c8058b240
commit
e4c63e0355
1 changed files with 2 additions and 0 deletions
|
@ -650,6 +650,8 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
||||||
private void checkAddress(String address) throws IllegalArgumentException, UnknownHostException {
|
private void checkAddress(String address) throws IllegalArgumentException, UnknownHostException {
|
||||||
if (address == null || TextUtils.isEmpty(address.trim()))
|
if (address == null || TextUtils.isEmpty(address.trim()))
|
||||||
throw new IllegalArgumentException("Bad address");
|
throw new IllegalArgumentException("Bad address");
|
||||||
|
if (!Util.isNumericAddress(address))
|
||||||
|
throw new IllegalArgumentException("Bad address");
|
||||||
InetAddress idns = InetAddress.getByName(address);
|
InetAddress idns = InetAddress.getByName(address);
|
||||||
if (idns.isLoopbackAddress() || idns.isAnyLocalAddress())
|
if (idns.isLoopbackAddress() || idns.isAnyLocalAddress())
|
||||||
throw new IllegalArgumentException("Bad address");
|
throw new IllegalArgumentException("Bad address");
|
||||||
|
|
Loading…
Reference in a new issue