QDnsLookup/Unix: fix off-by-one error in parsing the reply

Found this when the DNS server replied with no errors, no answers, and
no EDNS0 tail.

Amends eb51454b907b02aa67268c162896fc6778920e4c

Change-Id: Ie30a3caf09ef4176bb36fffd17cdf0916ac31545
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e3f520e621a9ea631d8a1d2f9bfc7a5f20dc698a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2024-05-09 14:52:20 -07:00 committed by Qt Cherry-pick Bot
parent 12ae2e8075
commit a371f0fd8c

View File

@ -273,7 +273,7 @@ void QDnsLookupRunnable::query(QDnsLookupReply *reply)
expandHost(offset);
if (status < 0)
return;
if (offset + status + 4 >= responseLength)
if (offset + status + 4 > responseLength)
header->qdcount = 0xffff; // invalid reply below
else
offset += status + 4;