1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-28 12:44:25 +01:00

dns: bad label size interpreted as decompression pointer (#466)

Co-authored-by: Bill Willcox <billwcorp@gmail.com>
This commit is contained in:
Bill Willcox
2022-02-20 18:18:00 -05:00
committed by GitHub
parent 54e4e4b0f4
commit c302e659d7
2 changed files with 52 additions and 1 deletions

View File

@@ -342,7 +342,7 @@ uint32_t DNS::compose_name(const uint8_t* ptr, char* out_ptr) const {
throw dns_decompression_pointer_loops();
}
// It's an offset
if ((*ptr & 0xc0)) {
if (((*ptr & 0xc0) == 0xc0)) {
if (TINS_UNLIKELY(ptr + sizeof(uint16_t) > end)) {
throw malformed_packet();
}