fix leak and overrun added in e49a477a

This commit is contained in:
zugz (tox) 2022-04-07 00:00:00 +00:00
parent cb34fe12d1
commit 697e8d0264
No known key found for this signature in database
GPG Key ID: 6F2BDA289D04F249
2 changed files with 3 additions and 2 deletions

View File

@ -1 +1 @@
7c43e683316530c0e9c46df4e670465b887f2a0c0774ee1dc67e4b0e1ca20a35 /usr/local/bin/tox-bootstrapd
2cf1f9b0e7e294b3fb767970c4cf310abbb3a690424f3483bf359ad5714d6ec7 /usr/local/bin/tox-bootstrapd

View File

@ -541,6 +541,7 @@ int dht_create_packet(const Random *rng, const uint8_t public_key[CRYPTO_PUBLIC_
}
if (length < 1 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE + encrypted_length) {
free(encrypted);
return -1;
}
@ -1034,7 +1035,7 @@ void set_announce_node(DHT *dht, const uint8_t *public_key)
index = LCLIENT_LENGTH - 1;
}
set_announce_node_in_list(dht->close_clientlist + index * LCLIENT_NODES, LCLIENT_LIST, public_key);
set_announce_node_in_list(dht->close_clientlist + index * LCLIENT_NODES, LCLIENT_LENGTH, public_key);
for (int32_t i = 0; i < dht->num_friends; ++i) {
set_announce_node_in_list(dht->friends_list[i].client_list, MAX_FRIEND_CLIENTS, public_key);