1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Fix memory access error when IPv6 prefix reading, should resolve #1972

This commit is contained in:
Evengard 2024-04-27 02:01:48 +03:00
parent 74f7269ef6
commit c9b5e25c87

View File

@ -2354,7 +2354,14 @@ void IPCIPv6AddRouterPrefixes(IPC *ipc, ICMPV6_OPTION_LIST *recvPrefix, UCHAR *m
IntToSubnetMask6(&newRA->RoutedMask, recvPrefix->Prefix[i]->SubnetLength); IntToSubnetMask6(&newRA->RoutedMask, recvPrefix->Prefix[i]->SubnetLength);
CopyIP(&newRA->RouterAddress, ip); CopyIP(&newRA->RouterAddress, ip);
Copy(newRA->RouterMacAddress, macAddress, 6); Copy(newRA->RouterMacAddress, macAddress, 6);
if (recvPrefix->SourceLinkLayer != NULL)
{
Copy(newRA->RouterLinkLayerAddress, recvPrefix->SourceLinkLayer->Address, 6); Copy(newRA->RouterLinkLayerAddress, recvPrefix->SourceLinkLayer->Address, 6);
}
else
{
Zero(newRA->RouterLinkLayerAddress, 6);
}
Add(ipc->IPv6RouterAdvs, newRA); Add(ipc->IPv6RouterAdvs, newRA);
} }
} }
@ -2657,7 +2664,7 @@ void IPCIPv6SendUnicast(IPC *ipc, void *data, UINT size, IP *next_ip)
} }
destMac = ra.RouterMacAddress; destMac = ra.RouterMacAddress;
if (!IsMacUnicast(destMac) && !IsMacInvalid(ra.RouterMacAddress)) if (!IsMacUnicast(destMac) && !IsMacInvalid(ra.RouterLinkLayerAddress))
{ {
destMac = ra.RouterLinkLayerAddress; destMac = ra.RouterLinkLayerAddress;
} }