Fixed bug.

memcmp is easy to confuse visually with memcpy but they do very different
things.

It was also comparing (copying) the senders real public key with their DHT
public key.
This commit is contained in:
irungentoo 2014-05-07 14:18:14 -04:00
parent 9cabfe845e
commit 9fccb80eec
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98

View File

@ -627,7 +627,7 @@ static int handle_dht_fakeid(void *object, IP_Port source, uint8_t *source_pubke
if ((uint32_t)len != length - (DATA_IN_RESPONSE_MIN_SIZE + crypto_box_NONCEBYTES))
return 1;
if (memcpy(source_pubkey, packet, crypto_box_PUBLICKEYBYTES) != 0)
if (memcmp(source_pubkey, plain + 1 + sizeof(uint64_t), crypto_box_PUBLICKEYBYTES) != 0)
return 1;
return handle_fakeid_announce(onion_c, packet, plain, len);