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

Pick-to: 6.7
Change-Id: Ie30a3caf09ef4176bb36fffd17cdf0916ac31545
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Thiago Macieira 2024-05-09 14:52:20 -07:00
parent 1961d42a3d
commit e3f520e621

View File

@ -310,7 +310,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;