Closed chradcliffe closed 7 years ago
Hi @chradcliffe
This is now fixed on master. Please not that I cannot reproduce the issue as clang/newer gcc version always 0-initialize class members if not done in constructors so I hope I covered everything ...
I noticed this issue when trying to craft a DNS packet with an empty question name. If passed an empty string, both
DNSQuery
andDNSAnswer
will not initialized thesize
member, which can lead to undefined behaviour if theWrite
method is then subsequently called. Here is a minimal example that, when compiled with GCC using-O3
on an Ubuntu 16.04 machine, prints an arbitrary large number as the size of theDNSQuery
:I think I would expect in this case for the library to create a DNS query whose QNAME field is a 16-bit length that is zero.