1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-06 07:44:57 +03:00

Fix bugs reported by Coverity Scan.

This commit is contained in:
Daiyuu Nobori
2018-09-28 22:39:38 +09:00
parent 06c06f1db8
commit ee9990317b
12 changed files with 29 additions and 15 deletions

View File

@ -513,7 +513,7 @@ void GetHomeDirW(wchar_t *path, UINT size)
if (GetEnvW(L"HOMEDRIVE", drive, sizeof(drive)) &&
GetEnvW(L"HOMEPATH", hpath, sizeof(hpath)))
{
UniFormat(path, sizeof(path), L"%s%s", drive, hpath);
UniFormat(path, size, L"%s%s", drive, hpath);
}
else
{

View File

@ -15081,7 +15081,7 @@ void GetMachineNameEx(char *name, UINT size, bool no_load_hosts)
{
if (GetMachineNameFromHosts(tmp2, sizeof(tmp2)))
{
StrCpy(name, sizeof(name), tmp2);
StrCpy(name, size, tmp2);
}
}
}

View File

@ -1824,7 +1824,7 @@ SECURE *OpenSec(UINT id)
return NULL;
}
sec->SlotIdList = (UINT *)ZeroMalloc(sizeof(UINT *) * sec->NumSlot);
sec->SlotIdList = (UINT *)ZeroMalloc(sizeof(UINT) * sec->NumSlot);
if (sec->Api->C_GetSlotList(TRUE, sec->SlotIdList, &sec->NumSlot) != CKR_OK)
{

View File

@ -999,7 +999,7 @@ BUF *BuildICMPv6NeighborSoliciation(IPV6_ADDR *src_ip, IPV6_ADDR *target_ip, UCH
UCHAR IPv6GetNextHeaderFromQueue(QUEUE *q)
{
UINT *p;
UCHAR v;
UCHAR v = 0;
// Validate arguments
if (q == NULL)
{
@ -1007,8 +1007,11 @@ UCHAR IPv6GetNextHeaderFromQueue(QUEUE *q)
}
p = (UINT *)GetNext(q);
v = (UCHAR)(*p);
Free(p);
if (p != NULL)
{
v = (UCHAR)(*p);
Free(p);
}
return v;
}

View File

@ -906,6 +906,8 @@ void *UnixNewSingleInstance(char *instance_name)
if (fcntl(fd, F_SETLK, &lock) == -1)
{
close(fd);
(void)remove(name);
return NULL;
}
else