diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/net_crypto.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/net_crypto.c b/core/net_crypto.c index 9a7500ea..3a3785ff 100644 --- a/core/net_crypto.c +++ b/core/net_crypto.c | |||
@@ -154,6 +154,10 @@ void random_nonce(uint8_t * nonce) | |||
154 | //return length of recieved data if successful | 154 | //return length of recieved data if successful |
155 | int read_cryptpacket(int crypt_connection_id, uint8_t * data) | 155 | int read_cryptpacket(int crypt_connection_id, uint8_t * data) |
156 | { | 156 | { |
157 | if(crypt_connection_id < 0 || crypt_connection_id >= MAX_CRYPTO_CONNECTIONS) | ||
158 | { | ||
159 | return 0; | ||
160 | } | ||
157 | if(crypto_connections[crypt_connection_id].status != 3) | 161 | if(crypto_connections[crypt_connection_id].status != 3) |
158 | { | 162 | { |
159 | return 0; | 163 | return 0; |
@@ -184,6 +188,10 @@ int read_cryptpacket(int crypt_connection_id, uint8_t * data) | |||
184 | //return 1 if data was put into the queue | 188 | //return 1 if data was put into the queue |
185 | int write_cryptpacket(int crypt_connection_id, uint8_t * data, uint32_t length) | 189 | int write_cryptpacket(int crypt_connection_id, uint8_t * data, uint32_t length) |
186 | { | 190 | { |
191 | if(crypt_connection_id < 0 || crypt_connection_id >= MAX_CRYPTO_CONNECTIONS) | ||
192 | { | ||
193 | return 0; | ||
194 | } | ||
187 | if(length - crypto_box_BOXZEROBYTES + crypto_box_ZEROBYTES > MAX_DATA_SIZE - 1) | 195 | if(length - crypto_box_BOXZEROBYTES + crypto_box_ZEROBYTES > MAX_DATA_SIZE - 1) |
188 | { | 196 | { |
189 | return 0; | 197 | return 0; |