1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-09-19 18:20:40 +03:00

Merge PR #707: src/Cedar/Hub.c: resolve null pointer dereference found by coverity

This commit is contained in:
Davide Beatrici 2018-09-19 04:23:56 +02:00 committed by GitHub
commit a78bcb4f21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5264,7 +5264,6 @@ bool IsIPManagementTargetForHUB(IP *ip, HUB *hub)
void DeleteOldIpTableEntry(LIST *o) void DeleteOldIpTableEntry(LIST *o)
{ {
UINT i; UINT i;
UINT64 oldest_time = 0xffffffffffffffffULL;
IP_TABLE_ENTRY *old = NULL; IP_TABLE_ENTRY *old = NULL;
// Validate arguments // Validate arguments
if (o == NULL) if (o == NULL)
@ -5275,12 +5274,8 @@ void DeleteOldIpTableEntry(LIST *o)
for (i = 0;i < LIST_NUM(o);i++) for (i = 0;i < LIST_NUM(o);i++)
{ {
IP_TABLE_ENTRY *e = LIST_DATA(o, i); IP_TABLE_ENTRY *e = LIST_DATA(o, i);
if (e->UpdatedTime <= oldest_time)
{
old = e; old = e;
} }
}
if (old != NULL) if (old != NULL)
{ {
@ -5394,7 +5389,7 @@ void StorePacketToHubPa(HUB_PA *dest, SESSION *src, void *data, UINT size, PKT *
} }
} }
if (src != NULL && src->Hub != NULL && src->Hub->Option != NULL && src->Hub->Option->FixForDLinkBPDU) if (packet != NULL && src != NULL && src->Hub != NULL && src->Hub->Option != NULL && src->Hub->Option->FixForDLinkBPDU)
{ {
// Measures for D-Link bug // Measures for D-Link bug
UCHAR *mac = packet->MacAddressSrc; UCHAR *mac = packet->MacAddressSrc;
@ -5840,10 +5835,8 @@ UPDATE_DHCP_ALLOC_ENTRY:
DeleteOldIpTableEntry(hub->IpTable); DeleteOldIpTableEntry(hub->IpTable);
} }
Insert(hub->IpTable, e); Insert(hub->IpTable, e);
}
if (new_entry)
{
if ((hub->Option != NULL && hub->Option->NoDhcpPacketLogOutsideHub == false) || mac_table->Session != s) if ((hub->Option != NULL && hub->Option->NoDhcpPacketLogOutsideHub == false) || mac_table->Session != s)
{ {
char dhcp_mac_addr[64]; char dhcp_mac_addr[64];