From 5865e3ac3dd7e208056d155140d9df2ee1875a15 Mon Sep 17 00:00:00 2001 From: Shilmoon <62980108+Shilmoon@users.noreply.github.com> Date: Thu, 29 Oct 2026 01:42:19 +0100 Subject: [PATCH] DNS outbound: Keep hijacked A/AAAA replies within the buffer (#7225) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/XTLS/Xray-core/pull/7225#pullrequestreview-5613859264 --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: 风扇滑翔翼 --- proxy/dns/dns.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proxy/dns/dns.go b/proxy/dns/dns.go index efeb56cda..712197bee 100644 --- a/proxy/dns/dns.go +++ b/proxy/dns/dns.go @@ -381,6 +381,13 @@ func (h *Handler) handleIPQuery(id uint16, qType dnsmessage.Type, domain string, errors.LogInfoInner(context.Background(), err, "pack message") b.Release() timer.SetTimeout(0) + return + } + if len(msgBytes) > buf.Size { + b.Release() + timer.SetTimeout(0) + errors.LogError(context.Background(), "DNS response message too large") + return } b.Resize(0, int32(len(msgBytes)))