mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Merge PR #643: resolve several issues found by coverity
This commit is contained in:
commit
0a289debf3
@ -19678,30 +19678,17 @@ UINT PsDhcpDisable(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
|
||||
}
|
||||
else
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
t.UseDhcp = false;
|
||||
|
||||
if (ok == false)
|
||||
ret = ScSetSecureNATOption(ps->Rpc, &t);
|
||||
|
||||
if (ret != ERR_NO_ERROR)
|
||||
{
|
||||
// Parameter is invalid
|
||||
ret = ERR_INVALID_PARAMETER;
|
||||
// An error has occured
|
||||
CmdPrintError(c, ret);
|
||||
FreeParamValueList(o);
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = ScSetSecureNATOption(ps->Rpc, &t);
|
||||
|
||||
if (ret != ERR_NO_ERROR)
|
||||
{
|
||||
// An error has occured
|
||||
CmdPrintError(c, ret);
|
||||
FreeParamValueList(o);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreeParamValueList(o);
|
||||
|
@ -2142,11 +2142,6 @@ PPP_PACKET *ParsePPPPacket(void *data, UINT size)
|
||||
|
||||
buf = (UCHAR *)data;
|
||||
|
||||
// Address
|
||||
if (size < 1)
|
||||
{
|
||||
goto LABEL_ERROR;
|
||||
}
|
||||
if (buf[0] != 0xff)
|
||||
{
|
||||
goto LABEL_ERROR;
|
||||
@ -2370,20 +2365,10 @@ PPP_LCP *ParseLCP(USHORT protocol, void *data, UINT size)
|
||||
|
||||
Zero(&o, sizeof(o));
|
||||
|
||||
// Type
|
||||
if (len < 1)
|
||||
{
|
||||
goto LABEL_ERROR;
|
||||
}
|
||||
o.Type = buf[0];
|
||||
buf++;
|
||||
len--;
|
||||
|
||||
// Length
|
||||
if (len < 1)
|
||||
{
|
||||
goto LABEL_ERROR;
|
||||
}
|
||||
o.DataSize = buf[0];
|
||||
if (o.DataSize < 2)
|
||||
{
|
||||
|
@ -1623,11 +1623,6 @@ OPENVPN_PACKET *OvsParsePacket(UCHAR *data, UINT size)
|
||||
|
||||
ret = ZeroMalloc(sizeof(OPENVPN_PACKET));
|
||||
|
||||
// OpCode + KeyID
|
||||
if (size < 1)
|
||||
{
|
||||
goto LABEL_ERROR;
|
||||
}
|
||||
uc = *((UCHAR *)data);
|
||||
data++;
|
||||
size--;
|
||||
|
@ -1145,14 +1145,7 @@ bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packe
|
||||
pl->Cedar = hub->Cedar;
|
||||
pl->Packet = p;
|
||||
pl->NoLog = no_log;
|
||||
if (src_session != NULL)
|
||||
{
|
||||
pl->SrcSessionName = CopyStr(src_session->Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
pl->SrcSessionName = CopyStr("");
|
||||
}
|
||||
pl->SrcSessionName = CopyStr(src_session->Name);
|
||||
if (dest_session != NULL)
|
||||
{
|
||||
pl->DestSessionName = CopyStr(dest_session->Name);
|
||||
|
@ -6112,51 +6112,12 @@ bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str)
|
||||
{
|
||||
// Root directory
|
||||
SERVER *s = c->Cedar->Server;
|
||||
bool is_free = false;
|
||||
|
||||
*error_detail_str = "HTTP_ROOT";
|
||||
|
||||
{
|
||||
if (is_free == false)
|
||||
{
|
||||
// Other than free version
|
||||
HttpSendForbidden(c->FirstSock, h->Target, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Free version
|
||||
BUF *b = ReadDump("|free.htm");
|
||||
|
||||
if (b != NULL)
|
||||
{
|
||||
char *src = ZeroMalloc(b->Size + 1);
|
||||
UINT dst_size = b->Size * 2 + 64;
|
||||
char *dst = ZeroMalloc(dst_size);
|
||||
char host[MAX_PATH];
|
||||
char portstr[64];
|
||||
|
||||
GetMachineName(host, sizeof(host));
|
||||
ToStr(portstr, c->FirstSock->LocalPort);
|
||||
|
||||
Copy(src, b->Buf, b->Size);
|
||||
ReplaceStrEx(dst, dst_size, src,
|
||||
"$HOST$", host, false);
|
||||
ReplaceStrEx(dst, dst_size, dst,
|
||||
"$PORT$", portstr, false);
|
||||
|
||||
FreeHttpHeader(h);
|
||||
h = NewHttpHeader("HTTP/1.1", "202", "OK");
|
||||
AddHttpValue(h, NewHttpValue("Content-Type", HTTP_CONTENT_TYPE4));
|
||||
AddHttpValue(h, NewHttpValue("Connection", "Keep-Alive"));
|
||||
AddHttpValue(h, NewHttpValue("Keep-Alive", HTTP_KEEP_ALIVE));
|
||||
PostHttp(c->FirstSock, h, dst, StrLen(dst));
|
||||
|
||||
Free(src);
|
||||
Free(dst);
|
||||
|
||||
FreeBuf(b);
|
||||
}
|
||||
}
|
||||
// Other than free version
|
||||
HttpSendForbidden(c->FirstSock, h->Target, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -5766,7 +5766,6 @@ void SiLoadServerCfg(SERVER *s, FOLDER *f)
|
||||
char tmp[MAX_SIZE];
|
||||
X *x = NULL;
|
||||
K *k = NULL;
|
||||
bool cluster_allowed = false;
|
||||
UINT num_connections_per_ip = 0;
|
||||
FOLDER *params_folder;
|
||||
UINT i;
|
||||
@ -6028,13 +6027,8 @@ void SiLoadServerCfg(SERVER *s, FOLDER *f)
|
||||
}
|
||||
Unlock(c->TrafficLock);
|
||||
|
||||
// Get whether the current license allows cluster mode
|
||||
cluster_allowed = true;
|
||||
|
||||
|
||||
// Type of server
|
||||
s->UpdatedServerType = s->ServerType =
|
||||
cluster_allowed ? CfgGetInt(f, "ServerType") : SERVER_TYPE_STANDALONE;
|
||||
s->UpdatedServerType = s->ServerType = CfgGetInt(f, "ServerType");
|
||||
|
||||
// Password
|
||||
if (CfgGetByte(f, "HashedPassword", s->HashedPassword, sizeof(s->HashedPassword)) != sizeof(s->HashedPassword))
|
||||
|
Loading…
Reference in New Issue
Block a user