summaryrefslogtreecommitdiff
path: root/core/net_crypto.c
diff options
context:
space:
mode:
authorSean Qureshi <stqism@risingstormgames.com>2013-08-18 01:31:54 -0700
committerSean Qureshi <stqism@risingstormgames.com>2013-08-18 01:31:54 -0700
commita03dcbb54ef1b8dfb4ae0b1f1b237bbe84b27b92 (patch)
treeee478c35b60cd5795abe5e9270d4eb7f183bec59 /core/net_crypto.c
parent17d38781743e0e9f03fbf41398ac6dffd32f28a5 (diff)
Fixes CERT MEM04-C; CWE-131 in net_crypto.c
Diffstat (limited to 'core/net_crypto.c')
-rw-r--r--core/net_crypto.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/net_crypto.c b/core/net_crypto.c
index 7fdd035f..6ced942b 100644
--- a/core/net_crypto.c
+++ b/core/net_crypto.c
@@ -406,6 +406,8 @@ static int getcryptconnection_id(uint8_t *public_key)
406 return -1 if realloc fails */ 406 return -1 if realloc fails */
407int realloc_cryptoconnection(uint32_t num) 407int realloc_cryptoconnection(uint32_t num)
408{ 408{
409 if (num * sizeof(Crypto_Connection) == 0) return -1;
410
409 Crypto_Connection *newcrypto_connections = realloc(crypto_connections, num * sizeof(Crypto_Connection)); 411 Crypto_Connection *newcrypto_connections = realloc(crypto_connections, num * sizeof(Crypto_Connection));
410 412
411 if (newcrypto_connections == NULL && num != 0) 413 if (newcrypto_connections == NULL && num != 0)