diff options
-rw-r--r-- | other/bootstrap_daemon/docker/tox-bootstrapd.sha256 | 2 | ||||
-rw-r--r-- | toxcore/DHT.c | 6 | ||||
-rw-r--r-- | toxcore/Messenger.c | 22 | ||||
-rw-r--r-- | toxcore/group.c | 7 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 3 | ||||
-rw-r--r-- | toxcore/network.c | 6 | ||||
-rw-r--r-- | toxcore/onion_announce.c | 3 | ||||
-rw-r--r-- | toxcore/onion_client.c | 3 |
8 files changed, 31 insertions, 21 deletions
diff --git a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 index 55bf67f6..20c33cbb 100644 --- a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 +++ b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 | |||
@@ -1 +1 @@ | |||
20306177ad19b1b6ad84469331a06d1c5c01f7918a95517105545f76d3c90d82 /usr/local/bin/tox-bootstrapd | 087432ee876325273dcb4015083adb88c46a55085a6d00741c6d7a2a385ea40c /usr/local/bin/tox-bootstrapd | ||
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 40f477fd..15f554e2 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -900,7 +900,8 @@ static bool incorrect_hardening(const IPPTsPng *assoc) | |||
900 | 900 | ||
901 | static int cmp_dht_entry(const void *a, const void *b) | 901 | static int cmp_dht_entry(const void *a, const void *b) |
902 | { | 902 | { |
903 | DHT_Cmp_data cmp1, cmp2; | 903 | DHT_Cmp_data cmp1; |
904 | DHT_Cmp_data cmp2; | ||
904 | memcpy(&cmp1, a, sizeof(DHT_Cmp_data)); | 905 | memcpy(&cmp1, a, sizeof(DHT_Cmp_data)); |
905 | memcpy(&cmp2, b, sizeof(DHT_Cmp_data)); | 906 | memcpy(&cmp2, b, sizeof(DHT_Cmp_data)); |
906 | const Client_data entry1 = cmp1.entry; | 907 | const Client_data entry1 = cmp1.entry; |
@@ -2418,7 +2419,8 @@ static int handle_hardening(void *object, IP_Port source, const uint8_t *source_ | |||
2418 | return 1; | 2419 | return 1; |
2419 | } | 2420 | } |
2420 | 2421 | ||
2421 | Node_format node, tocheck_node; | 2422 | Node_format node; |
2423 | Node_format tocheck_node; | ||
2422 | node.ip_port = source; | 2424 | node.ip_port = source; |
2423 | memcpy(node.public_key, source_pubkey, CRYPTO_PUBLIC_KEY_SIZE); | 2425 | memcpy(node.public_key, source_pubkey, CRYPTO_PUBLIC_KEY_SIZE); |
2424 | memcpy(&tocheck_node, packet + 1, sizeof(Node_format)); | 2426 | memcpy(&tocheck_node, packet + 1, sizeof(Node_format)); |
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 573cd64a..9984d7f0 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -1047,7 +1047,8 @@ int file_get_id(const Messenger *m, int32_t friendnumber, uint32_t filenumber, u | |||
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | uint32_t temp_filenum; | 1049 | uint32_t temp_filenum; |
1050 | uint8_t send_receive, file_number; | 1050 | uint8_t send_receive; |
1051 | uint8_t file_number; | ||
1051 | 1052 | ||
1052 | if (filenumber >= (1 << 16)) { | 1053 | if (filenumber >= (1 << 16)) { |
1053 | send_receive = 1; | 1054 | send_receive = 1; |
@@ -1209,7 +1210,8 @@ int file_control(const Messenger *m, int32_t friendnumber, uint32_t filenumber, | |||
1209 | } | 1210 | } |
1210 | 1211 | ||
1211 | uint32_t temp_filenum; | 1212 | uint32_t temp_filenum; |
1212 | uint8_t send_receive, file_number; | 1213 | uint8_t send_receive; |
1214 | uint8_t file_number; | ||
1213 | 1215 | ||
1214 | if (filenumber >= (1 << 16)) { | 1216 | if (filenumber >= (1 << 16)) { |
1215 | send_receive = 1; | 1217 | send_receive = 1; |
@@ -2568,9 +2570,9 @@ void do_messenger(Messenger *m, void *userdata) | |||
2568 | 2570 | ||
2569 | if (mono_time_get(m->mono_time) > m->lastdump + DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS) { | 2571 | if (mono_time_get(m->mono_time) > m->lastdump + DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS) { |
2570 | m->lastdump = mono_time_get(m->mono_time); | 2572 | m->lastdump = mono_time_get(m->mono_time); |
2571 | uint32_t client, last_pinged; | 2573 | uint32_t last_pinged; |
2572 | 2574 | ||
2573 | for (client = 0; client < LCLIENT_LIST; ++client) { | 2575 | for (uint32_t client = 0; client < LCLIENT_LIST; ++client) { |
2574 | const Client_data *cptr = dht_get_close_client(m->dht, client); | 2576 | const Client_data *cptr = dht_get_close_client(m->dht, client); |
2575 | const IPPTsPng *const assocs[] = { &cptr->assoc4, &cptr->assoc6, nullptr }; | 2577 | const IPPTsPng *const assocs[] = { &cptr->assoc4, &cptr->assoc6, nullptr }; |
2576 | 2578 | ||
@@ -2595,14 +2597,12 @@ void do_messenger(Messenger *m, void *userdata) | |||
2595 | } | 2597 | } |
2596 | 2598 | ||
2597 | 2599 | ||
2598 | uint32_t friend_idx, dhtfriend; | ||
2599 | |||
2600 | /* dht contains additional "friends" (requests) */ | 2600 | /* dht contains additional "friends" (requests) */ |
2601 | uint32_t num_dhtfriends = dht_get_num_friends(m->dht); | 2601 | uint32_t num_dhtfriends = dht_get_num_friends(m->dht); |
2602 | VLA(int32_t, m2dht, num_dhtfriends); | 2602 | VLA(int32_t, m2dht, num_dhtfriends); |
2603 | VLA(int32_t, dht2m, num_dhtfriends); | 2603 | VLA(int32_t, dht2m, num_dhtfriends); |
2604 | 2604 | ||
2605 | for (friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { | 2605 | for (uint32_t friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { |
2606 | m2dht[friend_idx] = -1; | 2606 | m2dht[friend_idx] = -1; |
2607 | dht2m[friend_idx] = -1; | 2607 | dht2m[friend_idx] = -1; |
2608 | 2608 | ||
@@ -2610,7 +2610,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2610 | continue; | 2610 | continue; |
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | for (dhtfriend = 0; dhtfriend < dht_get_num_friends(m->dht); ++dhtfriend) { | 2613 | for (uint32_t dhtfriend = 0; dhtfriend < dht_get_num_friends(m->dht); ++dhtfriend) { |
2614 | if (id_equal(m->friendlist[friend_idx].real_pk, dht_get_friend_public_key(m->dht, dhtfriend))) { | 2614 | if (id_equal(m->friendlist[friend_idx].real_pk, dht_get_friend_public_key(m->dht, dhtfriend))) { |
2615 | m2dht[friend_idx] = dhtfriend; | 2615 | m2dht[friend_idx] = dhtfriend; |
2616 | break; | 2616 | break; |
@@ -2618,7 +2618,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2618 | } | 2618 | } |
2619 | } | 2619 | } |
2620 | 2620 | ||
2621 | for (friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { | 2621 | for (uint32_t friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { |
2622 | if (m2dht[friend_idx] >= 0) { | 2622 | if (m2dht[friend_idx] >= 0) { |
2623 | dht2m[m2dht[friend_idx]] = friend_idx; | 2623 | dht2m[m2dht[friend_idx]] = friend_idx; |
2624 | } | 2624 | } |
@@ -2631,7 +2631,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2631 | Friend *msgfptr; | 2631 | Friend *msgfptr; |
2632 | DHT_Friend *dhtfptr; | 2632 | DHT_Friend *dhtfptr; |
2633 | 2633 | ||
2634 | for (friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { | 2634 | for (uint32_t friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { |
2635 | if (dht2m[friend_idx] >= 0) { | 2635 | if (dht2m[friend_idx] >= 0) { |
2636 | msgfptr = &m->friendlist[dht2m[friend_idx]]; | 2636 | msgfptr = &m->friendlist[dht2m[friend_idx]]; |
2637 | } else { | 2637 | } else { |
@@ -2651,7 +2651,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2651 | id_to_string(dht_friend_public_key(dhtfptr), id_str, sizeof(id_str))); | 2651 | id_to_string(dht_friend_public_key(dhtfptr), id_str, sizeof(id_str))); |
2652 | } | 2652 | } |
2653 | 2653 | ||
2654 | for (client = 0; client < MAX_FRIEND_CLIENTS; ++client) { | 2654 | for (uint32_t client = 0; client < MAX_FRIEND_CLIENTS; ++client) { |
2655 | const Client_data *cptr = dht_friend_client(dhtfptr, client); | 2655 | const Client_data *cptr = dht_friend_client(dhtfptr, client); |
2656 | const IPPTsPng *const assocs[] = {&cptr->assoc4, &cptr->assoc6}; | 2656 | const IPPTsPng *const assocs[] = {&cptr->assoc4, &cptr->assoc6}; |
2657 | 2657 | ||
diff --git a/toxcore/group.c b/toxcore/group.c index 02ca3cfe..e0be6ac0 100644 --- a/toxcore/group.c +++ b/toxcore/group.c | |||
@@ -1933,7 +1933,8 @@ static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, con | |||
1933 | return; | 1933 | return; |
1934 | } | 1934 | } |
1935 | 1935 | ||
1936 | uint16_t other_groupnum, groupnum; | 1936 | uint16_t other_groupnum; |
1937 | uint16_t groupnum; | ||
1937 | net_unpack_u16(data + 1, &other_groupnum); | 1938 | net_unpack_u16(data + 1, &other_groupnum); |
1938 | net_unpack_u16(data + 1 + sizeof(uint16_t), &groupnum); | 1939 | net_unpack_u16(data + 1 + sizeof(uint16_t), &groupnum); |
1939 | 1940 | ||
@@ -2883,7 +2884,9 @@ static int handle_lossy(void *object, int friendcon_id, const uint8_t *data, uin | |||
2883 | return -1; | 2884 | return -1; |
2884 | } | 2885 | } |
2885 | 2886 | ||
2886 | uint16_t groupnumber, peer_number, message_number; | 2887 | uint16_t groupnumber; |
2888 | uint16_t peer_number; | ||
2889 | uint16_t message_number; | ||
2887 | memcpy(&groupnumber, data + 1, sizeof(uint16_t)); | 2890 | memcpy(&groupnumber, data + 1, sizeof(uint16_t)); |
2888 | memcpy(&peer_number, data + 1 + sizeof(uint16_t), sizeof(uint16_t)); | 2891 | memcpy(&peer_number, data + 1 + sizeof(uint16_t), sizeof(uint16_t)); |
2889 | memcpy(&message_number, data + 1 + sizeof(uint16_t) * 2, sizeof(uint16_t)); | 2892 | memcpy(&message_number, data + 1 + sizeof(uint16_t) * 2, sizeof(uint16_t)); |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 3ed46a99..43cc8ab1 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1512,7 +1512,8 @@ static int handle_data_packet_core(Net_Crypto *c, int crypt_connection_id, const | |||
1512 | return -1; | 1512 | return -1; |
1513 | } | 1513 | } |
1514 | 1514 | ||
1515 | uint32_t buffer_start, num; | 1515 | uint32_t buffer_start; |
1516 | uint32_t num; | ||
1516 | memcpy(&buffer_start, data, sizeof(uint32_t)); | 1517 | memcpy(&buffer_start, data, sizeof(uint32_t)); |
1517 | memcpy(&num, data + sizeof(uint32_t), sizeof(uint32_t)); | 1518 | memcpy(&num, data + sizeof(uint32_t), sizeof(uint32_t)); |
1518 | buffer_start = net_ntohl(buffer_start); | 1519 | buffer_start = net_ntohl(buffer_start); |
diff --git a/toxcore/network.c b/toxcore/network.c index e5a58331..c448cb7e 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -1532,7 +1532,8 @@ size_t net_unpack_u16(const uint8_t *bytes, uint16_t *v) | |||
1532 | size_t net_unpack_u32(const uint8_t *bytes, uint32_t *v) | 1532 | size_t net_unpack_u32(const uint8_t *bytes, uint32_t *v) |
1533 | { | 1533 | { |
1534 | const uint8_t *p = bytes; | 1534 | const uint8_t *p = bytes; |
1535 | uint16_t lo, hi; | 1535 | uint16_t hi; |
1536 | uint16_t lo; | ||
1536 | p += net_unpack_u16(p, &hi); | 1537 | p += net_unpack_u16(p, &hi); |
1537 | p += net_unpack_u16(p, &lo); | 1538 | p += net_unpack_u16(p, &lo); |
1538 | *v = ((uint32_t)hi << 16) | lo; | 1539 | *v = ((uint32_t)hi << 16) | lo; |
@@ -1542,7 +1543,8 @@ size_t net_unpack_u32(const uint8_t *bytes, uint32_t *v) | |||
1542 | size_t net_unpack_u64(const uint8_t *bytes, uint64_t *v) | 1543 | size_t net_unpack_u64(const uint8_t *bytes, uint64_t *v) |
1543 | { | 1544 | { |
1544 | const uint8_t *p = bytes; | 1545 | const uint8_t *p = bytes; |
1545 | uint32_t lo, hi; | 1546 | uint32_t hi; |
1547 | uint32_t lo; | ||
1546 | p += net_unpack_u32(p, &hi); | 1548 | p += net_unpack_u32(p, &hi); |
1547 | p += net_unpack_u32(p, &lo); | 1549 | p += net_unpack_u32(p, &lo); |
1548 | *v = ((uint64_t)hi << 32) | lo; | 1550 | *v = ((uint64_t)hi << 32) | lo; |
diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c index 6d38012a..0a04a4b8 100644 --- a/toxcore/onion_announce.c +++ b/toxcore/onion_announce.c | |||
@@ -259,7 +259,8 @@ typedef struct Cmp_data { | |||
259 | 259 | ||
260 | static int cmp_entry(const void *a, const void *b) | 260 | static int cmp_entry(const void *a, const void *b) |
261 | { | 261 | { |
262 | Cmp_data cmp1, cmp2; | 262 | Cmp_data cmp1; |
263 | Cmp_data cmp2; | ||
263 | memcpy(&cmp1, a, sizeof(Cmp_data)); | 264 | memcpy(&cmp1, a, sizeof(Cmp_data)); |
264 | memcpy(&cmp2, b, sizeof(Cmp_data)); | 265 | memcpy(&cmp2, b, sizeof(Cmp_data)); |
265 | Onion_Announce_Entry entry1 = cmp1.entry; | 266 | Onion_Announce_Entry entry1 = cmp1.entry; |
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 7494ea94..c1b2dcf7 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -611,7 +611,8 @@ typedef struct Onion_Client_Cmp_data { | |||
611 | 611 | ||
612 | static int onion_client_cmp_entry(const void *a, const void *b) | 612 | static int onion_client_cmp_entry(const void *a, const void *b) |
613 | { | 613 | { |
614 | Onion_Client_Cmp_data cmp1, cmp2; | 614 | Onion_Client_Cmp_data cmp1; |
615 | Onion_Client_Cmp_data cmp2; | ||
615 | memcpy(&cmp1, a, sizeof(Onion_Client_Cmp_data)); | 616 | memcpy(&cmp1, a, sizeof(Onion_Client_Cmp_data)); |
616 | memcpy(&cmp2, b, sizeof(Onion_Client_Cmp_data)); | 617 | memcpy(&cmp2, b, sizeof(Onion_Client_Cmp_data)); |
617 | Onion_Node entry1 = cmp1.entry; | 618 | Onion_Node entry1 = cmp1.entry; |