diff --git a/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs b/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs index ce7c3b6..a6feecf 100644 --- a/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs +++ b/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs @@ -122,8 +122,7 @@ namespace FastGithub.PacketIntercept.Dns var responsePayload = response.ToArray(); // 修改payload和包长 - responsePayload.CopyTo(new Span(result.Data, responsePayload.Length)); - packet.Length = packet.Length + responsePayload.Length - requestPayload.Length; + packet.GetWriter(packet.Length - result.DataLength).Write(responsePayload); // 修改ip包 IPAddress destAddress; diff --git a/FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj b/FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj index 3b01562..62c1960 100644 --- a/FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj +++ b/FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj @@ -7,7 +7,7 @@ - +