mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01:30 +00:00
Copy DNS message struct instead of deep copy
This commit is contained in:
parent
8332878cdc
commit
bca0b86549
|
@ -270,7 +270,8 @@ func truncateDNSMessage(response *mDNS.Msg, maxLen int) *mDNS.Msg {
|
||||||
if responseLen <= maxLen {
|
if responseLen <= maxLen {
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
response = response.Copy()
|
newResponse := *response
|
||||||
|
response = &newResponse
|
||||||
for len(response.Answer) > 0 && responseLen > maxLen {
|
for len(response.Answer) > 0 && responseLen > maxLen {
|
||||||
response.Answer = response.Answer[:len(response.Answer)-1]
|
response.Answer = response.Answer[:len(response.Answer)-1]
|
||||||
response.Truncated = true
|
response.Truncated = true
|
||||||
|
|
Loading…
Reference in a new issue