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);
|
||||
} else {
|
||||
jid = Jid.ofEscaped(binding.accountJid.getText().toString());
|
||||
Resolver.checkDomain(jid);
|
||||
}
|
||||
} catch (final NullPointerException | IllegalArgumentException e) {
|
||||
if (mUsernameMode) {
|
||||
|
|
|
@ -37,6 +37,7 @@ import de.measite.minidns.record.SRV;
|
|||
import eu.siacs.conversations.Config;
|
||||
import eu.siacs.conversations.R;
|
||||
import eu.siacs.conversations.services.XmppConnectionService;
|
||||
import eu.siacs.conversations.xmpp.Jid;
|
||||
|
||||
public class Resolver {
|
||||
|
||||
|
@ -84,6 +85,10 @@ public class Resolver {
|
|||
return Collections.singletonList(result);
|
||||
}
|
||||
|
||||
public static void checkDomain(final Jid jid) {
|
||||
DNSName.from(jid.getDomain());
|
||||
}
|
||||
|
||||
public static boolean invalidHostname(final String hostname) {
|
||||
try {
|
||||
DNSName.from(hostname);
|
||||
|
|
Loading…
Reference in a new issue