From f3ea99e0b0aa13f21397e0c388eb58cda79fe40c Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Tue, 20 Nov 2012 18:31:33 -0300 Subject: [PATCH] Used a better strategy in DNSResourceRecord's constructor from buffer which will parse the data even if contains_dname returns false. --- src/dns_record.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/dns_record.cpp b/src/dns_record.cpp index ac57b59..8533981 100644 --- a/src/dns_record.cpp +++ b/src/dns_record.cpp @@ -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(); }