From a03dcbb54ef1b8dfb4ae0b1f1b237bbe84b27b92 Mon Sep 17 00:00:00 2001 From: Sean Qureshi Date: Sun, 18 Aug 2013 01:31:54 -0700 Subject: Fixes CERT MEM04-C; CWE-131 in net_crypto.c --- core/net_crypto.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/net_crypto.c') 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) return -1 if realloc fails */ 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)); if (newcrypto_connections == NULL && num != 0) -- cgit v1.2.3