remove arbitrary limit from dns result parsing

The name resolution would abort when getting more than 63 records per
request, due to what seems to be a left-over from the original code.
This check was non-breaking but spurious prior to TCP fallback
support, since any 512-byte packet with more than 63 records was
necessarily malformed. But now, it wrongly rejects valid results.

Reported by Daniel Stefanik in Alpine Linux aports issue 15320.
This commit is contained in:
Quentin Rameau 2023-10-04 21:29:43 +02:00 committed by Rich Felker
parent 2265a4c9b0
commit 8c086e7674
1 changed files with 0 additions and 1 deletions

View File

@ -12,7 +12,6 @@ int __dns_parse(const unsigned char *r, int rlen, int (*callback)(void *, int, c
p = r+12;
qdcount = r[4]*256 + r[5];
ancount = r[6]*256 + r[7];
if (qdcount+ancount > 64) return -1;
while (qdcount--) {
while (p-r < rlen && *p-1U < 127) p++;
if (p>r+rlen-6)