mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Used a better strategy in DNSResourceRecord's constructor from buffer which will parse the data even if contains_dname returns false.
This commit is contained in:
@@ -84,12 +84,10 @@ DNSResourceRecord::DNSResourceRecord(const uint8_t *buffer, uint32_t size)
|
||||
buffer += sizeof(uint16_t);
|
||||
if(buffer + data.size() > buffer_end)
|
||||
throw std::runtime_error("Not enough size for resource data");
|
||||
if(contains_dname(info_.type))
|
||||
if(contains_dname(info_.type) || data.size() != sizeof(uint32_t))
|
||||
std::copy(buffer, buffer + data.size(), data.begin());
|
||||
else if(data.size() == sizeof(uint32_t))
|
||||
*(uint32_t*)&data[0] = *(uint32_t*)buffer;
|
||||
else
|
||||
throw std::runtime_error("Not enough size for resource data");
|
||||
impl = tmp_impl.release();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user