diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-07 23:09:00 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-07 23:09:00 -0400 |
commit | 9a0d74908340e1a5e244eebae54feef584544261 (patch) | |
tree | eabb238c666de8aeb1f11a508438cd418cc57a1c /core/net_crypto.c | |
parent | a632d960f8d8095566530d1d0dc1393f02e1e07f (diff) |
Added IDEAS.txt and added checks to 2 net_crypto functions.
Diffstat (limited to 'core/net_crypto.c')
-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; |