atomashpolskiy / bt

BitTorrent library and client with DHT, magnet links, encryption and more
https://atomashpolskiy.github.io/bt/
Apache License 2.0
2.42k stars 381 forks source link

Determine getSha1Digest buffersize during runtime using metadata.length() #212

Closed dahlgrenm closed 2 years ago

dahlgrenm commented 2 years ago

To resolve #134.

This PR ensures that the buffer for bt.torrent.messaging.ExchangedMetadata.getSha1Digest is not larger than needed by using instead the smaller of metadata.length() and DEFAULT_BUFFER_SIZE.

atomashpolskiy commented 2 years ago

Thank you!