From e1dfb5348332b2bf589d2ba7b310d48b037cd18b Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 10 Apr 2016 20:08:10 +0200 Subject: [PATCH] Check answer data in MiniDnsResolver for the correct RR type. --- .../smack/util/dns/minidns/MiniDnsResolver.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/smack-resolver-minidns/src/main/java/org/jivesoftware/smack/util/dns/minidns/MiniDnsResolver.java b/smack-resolver-minidns/src/main/java/org/jivesoftware/smack/util/dns/minidns/MiniDnsResolver.java index 36a04620d..6b2b78d36 100644 --- a/smack-resolver-minidns/src/main/java/org/jivesoftware/smack/util/dns/minidns/MiniDnsResolver.java +++ b/smack-resolver-minidns/src/main/java/org/jivesoftware/smack/util/dns/minidns/MiniDnsResolver.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014 Florian Schmaus + * Copyright 2014-2016 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import de.measite.minidns.Question; import de.measite.minidns.Record; import de.measite.minidns.Record.CLASS; import de.measite.minidns.Record.TYPE; +import de.measite.minidns.record.Data; import de.measite.minidns.record.SRV; @@ -81,7 +82,11 @@ public class MiniDnsResolver implements SmackInitializer, DNSResolver { return res; } for (Record record : message.getAnswers()) { - SRV srv = (SRV) record.getPayload(); + Data data = record.getPayload(); + if (!(data instanceof SRV)) { + continue; + } + SRV srv = (SRV) data; res.add(new SRVRecord(srv.getName(), srv.getPort(), srv.getPriority(), srv.getWeight())); } return res;