From ae7a11cae9e220ce0a66bc48977104495759a01a Mon Sep 17 00:00:00 2001 From: irungentoo Date: Tue, 15 Jul 2014 13:39:32 -0400 Subject: [PATCH] Fixed TCP bug. Packet was being copied with a wrong, smaller length. --- toxcore/TCP_client.c | 2 +- toxcore/TCP_server.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index 2a2289b2..dbcae11b 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c @@ -165,7 +165,7 @@ static int write_packet_TCP_secure_connection(TCP_Client_Connection *con, const if ((unsigned int)len == sizeof(packet)) return 1; - memcpy(con->last_packet, packet, length); + memcpy(con->last_packet, packet, sizeof(packet)); con->last_packet_length = sizeof(packet); con->last_packet_sent = len; return 1; diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index 6c0133dd..e7ef0d3a 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c @@ -345,7 +345,7 @@ static int write_packet_TCP_secure_connection(TCP_Secure_Connection *con, const if ((unsigned int)len == sizeof(packet)) return 1; - memcpy(con->last_packet, packet, length); + memcpy(con->last_packet, packet, sizeof(packet)); con->last_packet_length = sizeof(packet); con->last_packet_sent = len; return 1;