1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Merge pull request #229 from chipitsine/master

cppcheck issues
This commit is contained in:
Daiyuu Nobori 2016-11-27 17:25:03 +09:00 committed by GitHub
commit 5cae447c79
9 changed files with 17 additions and 17 deletions

View File

@ -11840,12 +11840,12 @@ void InRpcHubEnumCa(RPC_HUB_ENUM_CA *t, PACK *p)
void OutRpcHubEnumCa(PACK *p, RPC_HUB_ENUM_CA *t)
{
UINT i;
PackAddStr(p, "HubName", t->HubName);
// Validate arguments
if (t == NULL || p == NULL)
{
return;
}
PackAddStr(p, "HubName", t->HubName);
for (i = 0;i < t->NumCa;i++)
{
@ -12313,12 +12313,12 @@ void InRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a, PACK *p)
void OutRpcEnumAccessList(PACK *p, RPC_ENUM_ACCESS_LIST *a)
{
UINT i;
PackAddStr(p, "HubName", a->HubName);
// Validate arguments
if (a == NULL || p == NULL)
{
return;
}
PackAddStr(p, "HubName", a->HubName);
for (i = 0;i < a->NumAccess;i++)
{
@ -12573,12 +12573,12 @@ void InRpcEnumUser(RPC_ENUM_USER *t, PACK *p)
void OutRpcEnumUser(PACK *p, RPC_ENUM_USER *t)
{
UINT i;
PackAddStr(p, "HubName", t->HubName);
// Validate arguments
if (t == NULL || p == NULL)
{
return;
}
PackAddStr(p, "HubName", t->HubName);
for (i = 0;i < t->NumUser;i++)
{
@ -12787,12 +12787,12 @@ void InRpcEnumSession(RPC_ENUM_SESSION *t, PACK *p)
void OutRpcEnumSession(PACK *p, RPC_ENUM_SESSION *t)
{
UINT i;
PackAddStr(p, "HubName", t->HubName);
// Validate arguments
if (t == NULL || p == NULL)
{
return;
}
PackAddStr(p, "HubName", t->HubName);
for (i = 0;i < t->NumSession;i++)
{

View File

@ -2181,13 +2181,13 @@ BUF *CiAccountToCfg(RPC_CLIENT_CREATE_ACCOUNT *t)
// RPC dispatch routine
PACK *CiRpcDispatch(RPC *rpc, char *name, PACK *p)
{
CLIENT *c = rpc->Param;
PACK *ret;
// Validate arguments
if (rpc == NULL || name == NULL || p == NULL)
{
return NULL;
}
CLIENT *c = rpc->Param;
ret = NewPack();
@ -6029,11 +6029,11 @@ L_TRY:
ReleaseSock(s);
ret = ZeroMalloc(sizeof(REMOTE_CLIENT));
ret->Rpc = rpc;
rpc->Param = ret;
if (ret != NULL)
{
ret->Rpc = rpc;
RPC_CLIENT_VERSION t;
Zero(&t, sizeof(t));
CcGetClientVersion(ret, &t);

View File

@ -1030,7 +1030,7 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
UINT size;
SESSION *s;
HUB *hub = NULL;
bool use_qos;
bool use_qos = false;
// Validate arguments
if (c == NULL)
{
@ -1038,11 +1038,11 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
}
s = c->Session;
use_qos = s->QoS;
if (s != NULL)
{
hub = s->Hub;
use_qos = s->QoS;
}
// Protocol

View File

@ -872,7 +872,6 @@ UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
// Get the ddns key from the server configuration file
static UINT SmDdnsGetKey(char *key, SM_DDNS *d){
RPC *rpc = d->s->Rpc;
RPC_CONFIG config;
UINT err;
BUF *buf;
@ -882,6 +881,7 @@ static UINT SmDdnsGetKey(char *key, SM_DDNS *d){
if(d == NULL || d->s == NULL || key == NULL){
return ERR_INTERNAL_ERROR;
}
RPC *rpc = d->s->Rpc;
Zero(&config, sizeof(config));
err = ScGetConfig(d->s->Rpc, &config);

View File

@ -116,7 +116,6 @@
// Polling process
void UdpAccelPoll(UDP_ACCEL *a)
{
UCHAR *tmp = a->TmpBuf;
IP nat_t_ip;
UINT num_ignore_errors = 0;
// Validate arguments
@ -124,6 +123,7 @@ void UdpAccelPoll(UDP_ACCEL *a)
{
return;
}
UCHAR *tmp = a->TmpBuf;
Lock(a->NatT_Lock);
{

View File

@ -2386,7 +2386,6 @@ bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
UINT64 next_send_tick = 0;
UINT64 giveup_time;
IPC *ipc;
UINT src_port = NnGenSrcPort(a->IsIpRawMode);
INTERRUPT_MANAGER *interrupt;
TUBE *tubes[3];
UINT num_tubes = 0;
@ -2399,6 +2398,7 @@ bool NnTestConnectivity(NATIVE_STACK *a, TUBE *halt_tube)
{
return false;
}
UINT src_port = NnGenSrcPort(a->IsIpRawMode);
Copy(&using_dns, &a->DnsServerIP, sizeof(IP));
@ -3997,7 +3997,6 @@ bool NatTransactIcmp(VH *v, NAT_ENTRY *n)
void *buf;
UINT recv_size;
BLOCK *block;
UINT dest_port = n->DestPort;
IP dest_ip;
UINT num_ignore_errors = 0;
// Validate arguments
@ -4005,6 +4004,7 @@ bool NatTransactIcmp(VH *v, NAT_ENTRY *n)
{
return true;
}
UINT dest_port = n->DestPort;
if (n->DisconnectNow)
{
@ -4200,7 +4200,6 @@ bool NatTransactUdp(VH *v, NAT_ENTRY *n)
void *buf;
UINT recv_size;
BLOCK *block;
UINT dest_port = n->DestPort;
IP dest_ip;
UINT num_ignore_errors;
// Validate arguments
@ -4208,6 +4207,7 @@ bool NatTransactUdp(VH *v, NAT_ENTRY *n)
{
return true;
}
UINT dest_port = n->DestPort;
if (n->DisconnectNow)
{

View File

@ -1725,12 +1725,12 @@ static wchar_t *WuUniReadFile(char *filename)
static void WuUniReplace(wchar_t **buf, wchar_t *from, wchar_t *to)
{
UINT dstsize;
wchar_t *oldbuf = *buf;
if(buf == NULL || from == NULL || to == NULL)
{
return;
}
wchar_t *oldbuf = *buf;
dstsize = (UniCalcReplaceStrEx(*buf, from, to, true) + 1) * sizeof(wchar_t);
*buf = (wchar_t*)Malloc(dstsize);

View File

@ -380,13 +380,13 @@ void ZipAddFileStart(ZIP_PACKER *p, char *name, UINT size, UINT64 dt, UINT attri
// Add data to the file
UINT ZipAddFileData(ZIP_PACKER *p, void *data, UINT pos, UINT len)
{
UINT total_size = p->CurrentFile->CurrentSize + len;
UINT ret;
// Validate arguments
if (p == NULL)
{
return 0;
}
UINT total_size = p->CurrentFile->CurrentSize + len;
if (total_size > p->CurrentFile->Size)
{
return 0;

View File

@ -1834,9 +1834,9 @@ PKT *ParsePacketEx4(UCHAR *buf, UINT size, bool no_l3, UINT vlan_type_id, bool b
if ((p->TypeL3 == L3_IPV4 || p->TypeL3 == L3_IPV6) && p->TypeL4 == L4_TCP)
{
TCP_HEADER *tcp = p->L4.TCPHeader;
if (tcp->DstPort == port_raw || tcp->DstPort == port_raw2)
if (tcp != NULL && (!((tcp->Flag & TCP_SYN) || (tcp->Flag & TCP_RST) || (tcp->Flag & TCP_FIN))))
{
if (tcp != NULL && (!((tcp->Flag & TCP_SYN) || (tcp->Flag & TCP_RST) || (tcp->Flag & TCP_FIN))))
if (tcp->DstPort == port_raw || tcp->DstPort == port_raw2)
{
if (p->PayloadSize >= 1)
{