1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Compare commits

...

4 Commits

Author SHA1 Message Date
619ca3d915
Merge branch 'SoftEtherVPN:master' into master 2024-05-03 16:08:16 +03:00
Ilya Shipitsin
9ce27f363e
Merge pull request #1990 from SoftEtherVPN/fix1972
Fix memory access error when IPv6 prefix reading, should resolve #1972
2024-04-28 17:25:16 +02:00
Evengard
d568cc1727 Fix another memory access error again because of a missing MAC address in IPv6 headers 2024-04-27 21:57:36 +03:00
Evengard
c9b5e25c87 Fix memory access error when IPv6 prefix reading, should resolve #1972 2024-04-27 02:01:48 +03:00

View File

@ -1517,7 +1517,9 @@ void IPCProcessL3EventsEx(IPC *ipc, UINT64 now)
// We save the router advertisement data for later use // We save the router advertisement data for later use
IPCIPv6AddRouterPrefixes(ipc, &p->ICMPv6HeaderPacketInfo.OptionList, src_mac, &ip_src); IPCIPv6AddRouterPrefixes(ipc, &p->ICMPv6HeaderPacketInfo.OptionList, src_mac, &ip_src);
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true); IPCIPv6AssociateOnNDTEx(ipc, &ip_src, src_mac, true);
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, true); if (p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer != NULL) {
IPCIPv6AssociateOnNDTEx(ipc, &ip_src, p->ICMPv6HeaderPacketInfo.OptionList.SourceLinkLayer->Address, true);
}
ndtProcessed = true; ndtProcessed = true;
header_size = sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER); header_size = sizeof(ICMPV6_ROUTER_ADVERTISEMENT_HEADER);
break; break;
@ -2354,7 +2356,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);
Copy(newRA->RouterLinkLayerAddress, recvPrefix->SourceLinkLayer->Address, 6); if (recvPrefix->SourceLinkLayer != NULL)
{
Copy(newRA->RouterLinkLayerAddress, recvPrefix->SourceLinkLayer->Address, 6);
}
else
{
Zero(newRA->RouterLinkLayerAddress, 6);
}
Add(ipc->IPv6RouterAdvs, newRA); Add(ipc->IPv6RouterAdvs, newRA);
} }
} }
@ -2657,7 +2666,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;
} }