resolved: put size limit in DnsAnswer size to UINT16_MAX
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Nov 2020 17:31:03 +0000 (18:31 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Nov 2020 19:35:04 +0000 (20:35 +0100)
commit398c611833584632c6977e2f89746403108637c7
treef0797475b14972c649497e51d7bee0f3d3a1a8ce
parenta63a1252b501f6c8b5a011825372977710e88e72
resolved: put size limit in DnsAnswer size to UINT16_MAX

The three answer sections can only carry up to UINT16_MAX entries, hence
put a hard upper limit on how far DnsAnswer can grow. The three count
fields in the DNS packet header are 16 bit only, hence the limit.

If code actually tries to add more than 64K RRs it will get ENOSPC with
this new checking.

And similar to DnsQuestion.
src/resolve/resolved-dns-answer.c
src/resolve/resolved-dns-question.c