1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 18:18:10 +00:00

(trunk libT) #4106 "Assert in buildHandshakeMessage, r12131" -- probable fix

This commit is contained in:
Jordan Lee 2011-03-11 19:28:44 +00:00
parent 77a0a0b619
commit 76fdae97cb

View file

@ -217,7 +217,7 @@ buildHandshakeMessage( tr_handshake * handshake, uint8_t * buf )
uint8_t * walk = buf; uint8_t * walk = buf;
const uint8_t * torrentHash = tr_cryptoGetTorrentHash( handshake->crypto ); const uint8_t * torrentHash = tr_cryptoGetTorrentHash( handshake->crypto );
const tr_torrent * tor = tr_torrentFindFromHash( handshake->session, torrentHash ); const tr_torrent * tor = tr_torrentFindFromHash( handshake->session, torrentHash );
const uint8_t * peer_id = tor ? tor->peer_id : tr_getPeerId( handshake->session ); const uint8_t * peer_id = tor && *tor->peer_id ? tor->peer_id : tr_getPeerId( handshake->session );
memcpy( walk, HANDSHAKE_NAME, HANDSHAKE_NAME_LEN ); memcpy( walk, HANDSHAKE_NAME, HANDSHAKE_NAME_LEN );
walk += HANDSHAKE_NAME_LEN; walk += HANDSHAKE_NAME_LEN;