forked from PGR/ascnet
1
0
Fork 0

pcap update

This commit is contained in:
rfi 2024-04-14 19:27:34 +07:00
parent 3bda362626
commit f3b3d70b2b
2 changed files with 7 additions and 0 deletions

View File

@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>

View File

@ -69,6 +69,12 @@ namespace AscNet.PcapParser
while (true) while (true)
{ {
if (4 > bytes.Length - readLen)
{
buffer[packet.Ethernet.IpV4.Source] = bytes.AsSpan(readLen).ToArray();
break;
}
int len = (int)BinaryPrimitives.ReadUInt32LittleEndian(bytes.AsSpan(readLen)); int len = (int)BinaryPrimitives.ReadUInt32LittleEndian(bytes.AsSpan(readLen));
readLen += Marshal.SizeOf<int>(); readLen += Marshal.SizeOf<int>();