mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
fix handshake.c crash reported by wereHamster
This commit is contained in:
parent
ab17f553c4
commit
d3d4047da0
1 changed files with 3 additions and 2 deletions
|
@ -228,9 +228,10 @@ parseHandshake( tr_handshake * handshake,
|
|||
|
||||
/* torrent hash */
|
||||
tr_peerIoReadBytes( handshake->io, inbuf, hash, sizeof(hash) );
|
||||
assert( tr_torrentExists( handshake->handle, hash ) );
|
||||
assert( tr_peerIoHasTorrentHash( handshake->io ) );
|
||||
if( memcmp( hash, tr_peerIoGetTorrentHash(handshake->io), SHA_DIGEST_LENGTH ) ) {
|
||||
if( !tr_torrentExists( handshake->handle, hash )
|
||||
|| memcmp( hash, tr_peerIoGetTorrentHash(handshake->io), SHA_DIGEST_LENGTH ) )
|
||||
{
|
||||
dbgmsg( handshake, "peer returned the wrong hash. wtf?" );
|
||||
return HANDSHAKE_BAD_TORRENT;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue