Fix dns truncate

This commit is contained in:
Mahdi
2025-10-03 14:07:45 -07:00
committed by 世界
parent 9362d3cab3
commit 886be6414d

View File

@@ -15,8 +15,7 @@ func TruncateDNSMessage(request *dns.Msg, response *dns.Msg, headroom int) (*buf
}
responseLen := response.Len()
if responseLen > maxLen {
copyResponse := *response
response = &copyResponse
response = response.Copy()
response.Truncate(maxLen)
}
buffer := buf.NewSize(headroom*2 + 1 + responseLen)