This commit is contained in:
Kyle Belanger 2024-04-14 08:28:08 -04:00
commit e0ef1d1c78
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>();