From bca0b86549125bc84395188a5d6c5925d75cd415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 10 Feb 2024 23:46:52 +0800 Subject: [PATCH] Copy DNS message struct instead of deep copy --- outbound/dns.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/outbound/dns.go b/outbound/dns.go index 0f003377..df32a019 100644 --- a/outbound/dns.go +++ b/outbound/dns.go @@ -270,7 +270,8 @@ func truncateDNSMessage(response *mDNS.Msg, maxLen int) *mDNS.Msg { if responseLen <= maxLen { return response } - response = response.Copy() + newResponse := *response + response = &newResponse for len(response.Answer) > 0 && responseLen > maxLen { response.Answer = response.Answer[:len(response.Answer)-1] response.Truncated = true