1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-25 19:09:52 +03:00

Merge PR #1276: fix several issues found by Coverity

This commit is contained in:
Davide Beatrici 2021-02-23 21:18:42 +01:00 committed by GitHub
commit 5ed11a0270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;
@ -2573,10 +2573,6 @@ PPP_PACKET *ParsePPPPacket(void *data, UINT size)
buf = (UCHAR *)data; buf = (UCHAR *)data;
// Address // Address
if (size < 1)
{
goto LABEL_ERROR;
}
if (buf[0] != 0xff) if (buf[0] != 0xff)
{ {
goto LABEL_ERROR; goto LABEL_ERROR;
@ -3745,7 +3741,7 @@ bool PPPParseUsername(CEDAR *cedar, char *src_username, ETHERIP_ID *dst)
char src[MAX_SIZE]; char src[MAX_SIZE];
// Validate arguments // Validate arguments
Zero(dst, sizeof(ETHERIP_ID)); Zero(dst, sizeof(ETHERIP_ID));
if (cedar == NULL || src == NULL || dst == NULL) if (cedar == NULL || dst == NULL)
{ {
return false; return false;
} }