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;