check domain name against DNSName to avoid rare crashes
This commit is contained in:
parent
ec02e8a198
commit
bf8afe0396
|
@ -208,6 +208,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
|
||||||
jid = Jid.ofEscaped(binding.accountJid.getText().toString(), getUserModeDomain(), null);
|
jid = Jid.ofEscaped(binding.accountJid.getText().toString(), getUserModeDomain(), null);
|
||||||
} else {
|
} else {
|
||||||
jid = Jid.ofEscaped(binding.accountJid.getText().toString());
|
jid = Jid.ofEscaped(binding.accountJid.getText().toString());
|
||||||
|
Resolver.checkDomain(jid);
|
||||||
}
|
}
|
||||||
} catch (final NullPointerException | IllegalArgumentException e) {
|
} catch (final NullPointerException | IllegalArgumentException e) {
|
||||||
if (mUsernameMode) {
|
if (mUsernameMode) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import de.measite.minidns.record.SRV;
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.R;
|
import eu.siacs.conversations.R;
|
||||||
import eu.siacs.conversations.services.XmppConnectionService;
|
import eu.siacs.conversations.services.XmppConnectionService;
|
||||||
|
import eu.siacs.conversations.xmpp.Jid;
|
||||||
|
|
||||||
public class Resolver {
|
public class Resolver {
|
||||||
|
|
||||||
|
@ -84,6 +85,10 @@ public class Resolver {
|
||||||
return Collections.singletonList(result);
|
return Collections.singletonList(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void checkDomain(final Jid jid) {
|
||||||
|
DNSName.from(jid.getDomain());
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean invalidHostname(final String hostname) {
|
public static boolean invalidHostname(final String hostname) {
|
||||||
try {
|
try {
|
||||||
DNSName.from(hostname);
|
DNSName.from(hostname);
|
||||||
|
|
Loading…
Reference in a new issue