From 7325b0e85a69d749cd4fe4c0cb067245018cb7a3 Mon Sep 17 00:00:00 2001 From: tonbuta <908584769@qq.com> Date: Sat, 14 Nov 2026 14:12:31 +0800 Subject: [PATCH] Fix long CNAME (cherry picked from commit dae22a0de2d5b87b378aaeb75c74bca852711afd) --- phantomtcp/dns.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phantomtcp/dns.go b/phantomtcp/dns.go index 3300c97..93e72b6 100755 --- a/phantomtcp/dns.go +++ b/phantomtcp/dns.go @@ -423,14 +423,14 @@ func GetName(buf []byte, offset int) (string, int) { if name != "" { name += "." } - if length < 63 { + if (length & 0xC0) != 0xC0 { name += string(buf[offset : offset+length]) offset += int(length) if offset+2 > len(buf) { return "", offset } } else { - _offset := int(buf[offset]) + _offset := int(binary.BigEndian.Uint16(buf[offset-1:offset+1]) & 0x3FFF) _name, _ := GetName(buf, _offset) name += _name return name, offset + 1