1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-25 10:59:53 +03:00

fix potential null pointer dereference found by Coverity

CID 355460 (#1 of 1): Dereference before null check (REVERSE_INULL)check_after_deref: Null-checking p suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
737                if (p == NULL)
738                {
739                        return false;
740                }
This commit is contained in:
Ilya Shipitsin 2021-02-24 00:26:44 +05:00
parent a08857150b
commit 2715d80e18

View File

@ -721,6 +721,12 @@ bool PPPProcessRetransmissions(PPP_SESSION *p)
// Send the PPP Echo Request // Send the PPP Echo Request
bool PPPSendEchoRequest(PPP_SESSION *p) bool PPPSendEchoRequest(PPP_SESSION *p)
{ {
// Validate arguments
if (p == NULL)
{
return false;
}
UINT64 now = Tick64(); UINT64 now = Tick64();
if (p->NextEchoSendTime == 0 || now >= p->NextEchoSendTime) if (p->NextEchoSendTime == 0 || now >= p->NextEchoSendTime)
{ {
@ -733,12 +739,6 @@ bool PPPSendEchoRequest(PPP_SESSION *p)
AddInterrupt(p->Ipc->Interrupt, p->NextEchoSendTime); AddInterrupt(p->Ipc->Interrupt, p->NextEchoSendTime);
} }
// Validate arguments
if (p == NULL)
{
return false;
}
pp = ZeroMalloc(sizeof(PPP_PACKET)); pp = ZeroMalloc(sizeof(PPP_PACKET));
pp->Protocol = PPP_PROTOCOL_LCP; pp->Protocol = PPP_PROTOCOL_LCP;
pp->IsControl = true; pp->IsControl = true;