1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-12 07:03:44 +00:00

Fix erratic `(int)EVBUFFER_LENGTH( inbuf ) >= byteCount' error

This commit is contained in:
Charles Kerr 2007-10-02 16:59:56 +00:00
parent cdabb1c0b1
commit f4901211ca

View file

@ -797,7 +797,11 @@ readCryptoProvide( tr_handshake * handshake, struct evbuffer * inbuf )
uint8_t obfuscatedTorrentHash[SHA_DIGEST_LENGTH]; uint8_t obfuscatedTorrentHash[SHA_DIGEST_LENGTH];
uint16_t padc_len = 0; uint16_t padc_len = 0;
uint32_t crypto_provide = 0; uint32_t crypto_provide = 0;
const size_t needlen = SHA_DIGEST_LENGTH + VC_LENGTH + sizeof(crypto_provide) + sizeof(padc_len); const size_t needlen = SHA_DIGEST_LENGTH /* HASH('req1',s) */
+ SHA_DIGEST_LENGTH /* HASH('req2', SKEY) xor HASH('req3', S) */
+ VC_LENGTH
+ sizeof(crypto_provide)
+ sizeof(padc_len);
tr_torrent * tor = NULL; tr_torrent * tor = NULL;
if( EVBUFFER_LENGTH(inbuf) < needlen ) if( EVBUFFER_LENGTH(inbuf) < needlen )