summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-08-30 14:11:12 -0400
committerirungentoo <irungentoo@gmail.com>2013-08-30 14:11:12 -0400
commit52c47a0820001b4025b7ebe4f1f6df0a313cf53b (patch)
tree4d21039ab75a33902c662cf6e1140b44aada1747
parent0bd4edc0dbe67f32de7e63232ba169619e363ec8 (diff)
Fixed possible crash.
-rw-r--r--toxcore/Lossless_UDP.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c
index 7c838510..270b4b35 100644
--- a/toxcore/Lossless_UDP.c
+++ b/toxcore/Lossless_UDP.c
@@ -703,7 +703,10 @@ static int handle_data(void *object, IP_Port source, uint8_t *packet, uint32_t l
703 int connection_id = getconnection_id(ludp, source); 703 int connection_id = getconnection_id(ludp, source);
704 704
705 /* Drop the data packet if connection is not connected. */ 705 /* Drop the data packet if connection is not connected. */
706 if (connection_id == -1 || tox_array_get(&ludp->connections, connection_id, Connection).status != 3) 706 if (connection_id == -1)
707 return 1;
708
709 if (tox_array_get(&ludp->connections, connection_id, Connection).status != 3)
707 return 1; 710 return 1;
708 711
709 if (length > 1 + 4 + MAX_DATA_SIZE || length < 1 + 4 + 1) 712 if (length > 1 + 4 + MAX_DATA_SIZE || length < 1 + 4 + 1)