mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixes CERT MEM04-C; CWE-131 in net_crypto.c
This commit is contained in:
parent
17d3878174
commit
a03dcbb54e
|
@ -406,6 +406,8 @@ static int getcryptconnection_id(uint8_t *public_key)
|
||||||
return -1 if realloc fails */
|
return -1 if realloc fails */
|
||||||
int realloc_cryptoconnection(uint32_t num)
|
int realloc_cryptoconnection(uint32_t num)
|
||||||
{
|
{
|
||||||
|
if (num * sizeof(Crypto_Connection) == 0) return -1;
|
||||||
|
|
||||||
Crypto_Connection *newcrypto_connections = realloc(crypto_connections, num * sizeof(Crypto_Connection));
|
Crypto_Connection *newcrypto_connections = realloc(crypto_connections, num * sizeof(Crypto_Connection));
|
||||||
|
|
||||||
if (newcrypto_connections == NULL && num != 0)
|
if (newcrypto_connections == NULL && num != 0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user