1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-12-26 18:19:53 +03:00

src/Cedar/Connection: resolve null pointer dereference found by coverity,

remove unused function

[src/Cedar/Connection.c:2861]: (style) The function 'InitTcpSockRc4Key' is never used.
This commit is contained in:
Ilya Shipitsin 2018-08-24 15:26:14 +05:00
parent a58d26f125
commit dcd03476c4
2 changed files with 1 additions and 30 deletions

View File

@ -1171,7 +1171,7 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
UINT j;
QUEUE *q;
if (s->UdpAccel != NULL)
if (s != NULL && s->UdpAccel != NULL)
{
UdpAccelSetTick(s->UdpAccel, now);
}
@ -2857,34 +2857,6 @@ TCPSOCK *NewTcpSock(SOCK *s)
return ts;
}
// Set a encryption key for the TCP socket
void InitTcpSockRc4Key(TCPSOCK *ts, bool server_mode)
{
RC4_KEY_PAIR *pair;
CRYPT *c1, *c2;
// Validate arguments
if (ts == NULL)
{
return;
}
pair = &ts->Rc4KeyPair;
c1 = NewCrypt(pair->ClientToServerKey, sizeof(pair->ClientToServerKey));
c2 = NewCrypt(pair->ServerToClientKey, sizeof(pair->ServerToClientKey));
if (server_mode)
{
ts->RecvKey = c1;
ts->SendKey = c2;
}
else
{
ts->SendKey = c1;
ts->RecvKey = c2;
}
}
// Release of TCP socket
void FreeTcpSock(TCPSOCK *ts)
{

View File

@ -351,7 +351,6 @@ void DisconnectUDPSockets(CONNECTION *c);
void PutUDPPacketData(CONNECTION *c, void *data, UINT size);
void SendDataWithUDP(SOCK *s, CONNECTION *c);
void InsertReceivedBlockToQueue(CONNECTION *c, BLOCK *block, bool no_lock);
void InitTcpSockRc4Key(TCPSOCK *ts, bool server_mode);
UINT TcpSockRecv(SESSION *s, TCPSOCK *ts, void *data, UINT size);
UINT TcpSockSend(SESSION *s, TCPSOCK *ts, void *data, UINT size);
void WriteSendFifo(SESSION *s, TCPSOCK *ts, void *data, UINT size);