summaryrefslogtreecommitdiff
path: root/toxcore/friend_connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/friend_connection.c')
-rw-r--r--toxcore/friend_connection.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c
index 2fb768ea..a63855af 100644
--- a/toxcore/friend_connection.c
+++ b/toxcore/friend_connection.c
@@ -791,17 +791,17 @@ int send_friend_request_packet(Friend_Connections *fr_c, int friendcon_id, uint3
791 return -1; 791 return -1;
792 } 792 }
793 793
794 uint8_t packet[1 + sizeof(nospam_num) + length]; 794 VLA(uint8_t, packet, 1 + sizeof(nospam_num) + length);
795 memcpy(packet + 1, &nospam_num, sizeof(nospam_num)); 795 memcpy(packet + 1, &nospam_num, sizeof(nospam_num));
796 memcpy(packet + 1 + sizeof(nospam_num), data, length); 796 memcpy(packet + 1 + sizeof(nospam_num), data, length);
797 797
798 if (friend_con->status == FRIENDCONN_STATUS_CONNECTED) { 798 if (friend_con->status == FRIENDCONN_STATUS_CONNECTED) {
799 packet[0] = PACKET_ID_FRIEND_REQUESTS; 799 packet[0] = PACKET_ID_FRIEND_REQUESTS;
800 return write_cryptpacket(fr_c->net_crypto, friend_con->crypt_connection_id, packet, sizeof(packet), 0) != -1; 800 return write_cryptpacket(fr_c->net_crypto, friend_con->crypt_connection_id, packet, SIZEOF_VLA(packet), 0) != -1;
801 } 801 }
802 802
803 packet[0] = CRYPTO_PACKET_FRIEND_REQ; 803 packet[0] = CRYPTO_PACKET_FRIEND_REQ;
804 int num = send_onion_data(fr_c->onion_c, friend_con->onion_friendnum, packet, sizeof(packet)); 804 int num = send_onion_data(fr_c->onion_c, friend_con->onion_friendnum, packet, SIZEOF_VLA(packet));
805 805
806 if (num <= 0) { 806 if (num <= 0) {
807 return -1; 807 return -1;