summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-05-12 08:08:24 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-05-15 14:54:00 -0700
commit25869c0aad8ab58914053c2977582514ed4c19d7 (patch)
tree834b411091a060af8a8d57d19035956f822674c2
parentc113a7a7969781877acfe30eb8e20c66f69f94f0 (diff)
downloadqtbase-25869c0aad8ab58914053c2977582514ed4c19d7.tar.gz
QDnsLookup/Unix: do skip DNS records that aren't of class IN
There's nothing saying the server can't supply those to us, so let's explicitly skip them. The Windows version already does this because the windns.h API only supports records of class IN. Test for this after setNameserverPort() is added. Pick-to: 6.5 Change-Id: I3e3bfef633af4130a03afffd175e6ddc756c91c5 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
-rw-r--r--src/network/kernel/qdnslookup_unix.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
index 0e10e8f928..7eeb6538a2 100644
--- a/src/network/kernel/qdnslookup_unix.cpp
+++ b/src/network/kernel/qdnslookup_unix.cpp
@@ -218,6 +218,7 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
}
const quint16 type = (p[0] << 8) | p[1];
p += 2; // RR type
+ const qint16 rrclass = (p[0] << 8) | p[1];
p += 2; // RR class
const quint32 ttl = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
p += 4;
@@ -225,6 +226,8 @@ void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestN
p += 2;
if ((p - response) + size > responseLength)
return; // truncated
+ if (rrclass != C_IN)
+ continue;
if (type == QDnsLookup::A) {
if (size != 4) {