1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Soften DNS parsing rules. Fixes #74.

This commit is contained in:
Matias Fontanini
2015-05-10 12:19:58 -07:00
parent 460e87cb43
commit d1ffecb132
2 changed files with 24 additions and 3 deletions

View File

@@ -328,7 +328,7 @@ const uint8_t* DNS::compose_name(const uint8_t *ptr, char *out_ptr) const {
std::memcpy(&index, ptr, sizeof(uint16_t));
index = Endian::be_to_host(index) & 0x3fff;
// Check that the offset is neither too low or too high
if(index < 0x0c || (&records_data[0] + (index - 0x0c)) >= ptr)
if(index < 0x0c || (&records_data[0] + (index - 0x0c)) >= end)
throw malformed_packet();
// We've probably found the end of the original domain name. Save it.
if(end_ptr == 0)