atomashpolskiy / bt

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

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

Closed dahlgrenm closed 1 year ago

dahlgrenm commented 1 year 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 1 year ago

Thank you!