From 25869c0aad8ab58914053c2977582514ed4c19d7 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 12 May 2023 08:08:24 -0700 Subject: [PATCH] QDnsLookup/Unix: do skip DNS records that aren't of class IN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/network/kernel/qdnslookup_unix.cpp | 3 +++ 1 file changed, 3 insertions(+) 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) {