addressbook: Prevent Base32 hostnames

This commit is contained in:
zzz
2009-01-05 15:06:29 +00:00
parent 53ce3c4802
commit 5c1864ed5e

View File

@ -179,6 +179,8 @@ public class AddressBook {
// IDN - basic check, not complete validation // IDN - basic check, not complete validation
(host.indexOf("--") < 0 || host.startsWith("xn--") || host.indexOf(".xn--") > 0) && (host.indexOf("--") < 0 || host.startsWith("xn--") || host.indexOf(".xn--") > 0) &&
host.replaceAll("[a-z0-9.-]", "").length() == 0 && host.replaceAll("[a-z0-9.-]", "").length() == 0 &&
// Base32 spoofing (52chars.i2p)
(! (host.length() == 56 && host.substring(0,52).replaceAll("[a-z2-7]", "").length() == 0)) &&
// some reserved names that may be used for local configuration someday // some reserved names that may be used for local configuration someday
(! host.equals("proxy.i2p")) && (! host.equals("proxy.i2p")) &&
(! host.equals("router.i2p")) && (! host.equals("router.i2p")) &&