forked from premiere/premiere-libtorrent
handle incoming invalid piece messages sizes
This commit is contained in:
parent
58ea6f5b3c
commit
2ab17b7a51
|
@ -1155,6 +1155,12 @@ namespace libtorrent
|
|||
return;
|
||||
}
|
||||
|
||||
if (packet_size() - 13 - list_size > t->block_size())
|
||||
{
|
||||
disconnect(errors::packet_too_large, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
TORRENT_ASSERT(!has_disk_receive_buffer());
|
||||
if (!allocate_disk_receive_buffer(packet_size() - 13 - list_size))
|
||||
{
|
||||
|
@ -1168,6 +1174,13 @@ namespace libtorrent
|
|||
if (recv_pos == 1)
|
||||
{
|
||||
TORRENT_ASSERT(!has_disk_receive_buffer());
|
||||
|
||||
if (packet_size() - 9 > t->block_size())
|
||||
{
|
||||
disconnect(errors::packet_too_large, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!allocate_disk_receive_buffer(packet_size() - 9))
|
||||
{
|
||||
m_statistics.received_bytes(0, received);
|
||||
|
|
Loading…
Reference in New Issue