1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Merge pull request #275 from chipitsine/master

cppcheck findings
This commit is contained in:
Moataz Elmasry 2018-02-01 00:06:08 +01:00 committed by GitHub
commit a5fa265811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 11 deletions

View File

@ -410,11 +410,12 @@ PACK *AdminDispatch(RPC *rpc, char *name, PACK *p)
server = a->Server; server = a->Server;
if (server != NULL) if (server == NULL)
{ {
cedar = server->Cedar; return NULL;
} }
cedar = server->Cedar;
Lock(cedar->CedarSuperLock); Lock(cedar->CedarSuperLock);
if (true) if (true)

View File

@ -6652,7 +6652,10 @@ SOCK *SocksConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
if (c == NULL || proxy_host_name == NULL || proxy_port == 0 || server_host_name == NULL if (c == NULL || proxy_host_name == NULL || proxy_port == 0 || server_host_name == NULL
|| server_port == 0) || server_port == 0)
{ {
c->Err = ERR_PROXY_CONNECT_FAILED; if (c != NULL)
{
c->Err = ERR_PROXY_CONNECT_FAILED;
}
return NULL; return NULL;
} }
@ -6846,7 +6849,10 @@ SOCK *ProxyConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
if (c == NULL || proxy_host_name == NULL || proxy_port == 0 || server_host_name == NULL || if (c == NULL || proxy_host_name == NULL || proxy_port == 0 || server_host_name == NULL ||
server_port == 0) server_port == 0)
{ {
c->Err = ERR_PROXY_CONNECT_FAILED; if( c != NULL)
{
c->Err = ERR_PROXY_CONNECT_FAILED;
}
return NULL; return NULL;
} }
if (username != NULL && password != NULL && if (username != NULL && password != NULL &&

View File

@ -326,7 +326,7 @@ static wchar_t *WpListener(WEBUI *wu, LIST *params)
WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey); WU_CONTEXT *context = WuGetContext(wu->Contexts, sessionkey);
char *cmd = (char*)StrMapSearch(params, "CMD"); char *cmd = (char*)StrMapSearch(params, "CMD");
RPC_LISTENER t; RPC_LISTENER t;
UINT retcode; UINT retcode = ERR_NO_ERROR;
if(context == NULL) if(context == NULL)
{ {

View File

@ -2338,6 +2338,11 @@ void CfgDeleteFolder(FOLDER *f)
return; return;
} }
if(f->Folders == NULL)
{
return;
}
// Remove all subfolders // Remove all subfolders
num = LIST_NUM(f->Folders); num = LIST_NUM(f->Folders);
ff = Malloc(sizeof(FOLDER *) * num); ff = Malloc(sizeof(FOLDER *) * num);

View File

@ -4424,7 +4424,7 @@ void DesEcbEncrypt(void *dst, void *src, void *key_7bytes)
DES_cblock key; DES_cblock key;
DES_key_schedule ks; DES_key_schedule ks;
// Validate arguments // Validate arguments
if (dst == NULL || src == NULL || key == NULL) if (dst == NULL || src == NULL || key_7bytes == NULL)
{ {
return; return;
} }

View File

@ -2038,7 +2038,7 @@ UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size)
while (true) while (true)
{ {
UINT type; UINT type;
wchar_t c; wchar_t c = 0;
BYTE c1, c2; BYTE c1, c2;
type = GetUtf8Type(u, u_size, i); type = GetUtf8Type(u, u_size, i);
@ -2063,8 +2063,6 @@ UINT Utf8ToUni(wchar_t *s, UINT size, BYTE *u, UINT u_size)
} }
i += type; i += type;
c = 0;
if (IsBigEndian()) if (IsBigEndian())
{ {
if (sizeof(wchar_t) == 2) if (sizeof(wchar_t) == 2)

View File

@ -2659,7 +2659,7 @@ void RUDPBulkSend(RUDP_STACK *r, RUDP_SESSION *se, void *data, UINT data_size)
CRYPT *c; CRYPT *c;
UCHAR crypt_key_src[SHA1_SIZE * 2]; UCHAR crypt_key_src[SHA1_SIZE * 2];
UCHAR crypt_key[SHA1_SIZE]; UCHAR crypt_key[SHA1_SIZE];
UINT icmp_type; UINT icmp_type = 0;
UCHAR sign[SHA1_SIZE]; UCHAR sign[SHA1_SIZE];
UCHAR iv[SHA1_SIZE + 1]; UCHAR iv[SHA1_SIZE + 1];
// Validate arguments // Validate arguments
@ -13512,7 +13512,7 @@ UINT SecureRecv(SOCK *sock, void *data, UINT size)
UINT SecureSend(SOCK *sock, void *data, UINT size) UINT SecureSend(SOCK *sock, void *data, UINT size)
{ {
SOCKET s; SOCKET s;
int ret, e; int ret, e = SSL_ERROR_NONE;
SSL *ssl; SSL *ssl;
s = sock->socket; s = sock->socket;
ssl = sock->ssl; ssl = sock->ssl;