From 7c203971c19302dd49c651016f98cbbaac3f8340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=9B=BD=E4=BC=9F?= <366193849@qq.com> Date: Thu, 20 Oct 2022 10:45:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8Writer=E5=86=99=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FastGithub.PacketIntercept/Dns/DnsInterceptor.cs | 3 +-- FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) 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 @@ - +