mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed regression, announce responses can contain 0 nodes.
This commit is contained in:
parent
f9bf7b074a
commit
be413de396
|
@ -186,6 +186,7 @@ START_TEST(test_basic)
|
|||
while (handled_test_3 == 0) {
|
||||
do_onion(onion1);
|
||||
do_onion(onion2);
|
||||
c_sleep(50);
|
||||
}
|
||||
|
||||
randombytes(sb_data, sizeof(sb_data));
|
||||
|
|
|
@ -268,10 +268,14 @@ static int handle_announce_request(void *object, IP_Port source, uint8_t *packet
|
|||
}
|
||||
}
|
||||
|
||||
int nodes_length = pack_nodes(pl + 1 + ONION_PING_ID_SIZE, sizeof(nodes_list), nodes_list, num_nodes);
|
||||
int nodes_length = 0;
|
||||
|
||||
if (nodes_length <= 0)
|
||||
return 1;
|
||||
if (num_nodes != 0) {
|
||||
nodes_length = pack_nodes(pl + 1 + ONION_PING_ID_SIZE, sizeof(nodes_list), nodes_list, num_nodes);
|
||||
|
||||
if (nodes_length <= 0)
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t data[ONION_ANNOUNCE_RESPONSE_MAX_SIZE];
|
||||
len = encrypt_data_fast(shared_key, nonce, pl, 1 + ONION_PING_ID_SIZE + nodes_length,
|
||||
|
|
Loading…
Reference in New Issue
Block a user