diff --git a/libi2pd_client/Torrents.cpp b/libi2pd_client/Torrents.cpp index c1c67526..463e0fce 100644 --- a/libi2pd_client/Torrents.cpp +++ b/libi2pd_client/Torrents.cpp @@ -644,7 +644,10 @@ namespace torrents }); if (len && fileLength && !filePath.empty ()) { - m_Files.emplace_back (std::make_shared (filePath, fileLength)); + if (m_Files.size () < MAX_NUM_TORRENT_FILES) + m_Files.emplace_back (std::make_shared (filePath, fileLength)); + else + m_Error = eTorrentErrorMalformedMetaInfo; if (m_Length + fileLength <= MAX_TORRENT_LENGTH) m_Length += fileLength; else diff --git a/libi2pd_client/Torrents.h b/libi2pd_client/Torrents.h index e4e1c212..d2cd920c 100644 --- a/libi2pd_client/Torrents.h +++ b/libi2pd_client/Torrents.h @@ -37,9 +37,10 @@ namespace torrents { constexpr size_t REQUEST_BLOCK_SIZE = 16384; constexpr size_t MIN_PIECE_LENGTH = 16*1024; // 16K - constexpr size_t MAX_PIECE_LENGTH = 64*1024*1024; // 64M + constexpr size_t MAX_PIECE_LENGTH = 256*1024*1024; // 256M constexpr size_t MAX_NUM_TORRENT_PIECES = 1024*1024; // 1M - constexpr size_t MAX_TORRENT_LENGTH = MAX_PIECE_LENGTH*MAX_NUM_TORRENT_PIECES; // 64T + constexpr size_t MAX_TORRENT_LENGTH = MAX_PIECE_LENGTH*MAX_NUM_TORRENT_PIECES; // 256T + constexpr size_t MAX_NUM_TORRENT_FILES = 10000; constexpr uint16_t TORRENT_PORT = 6881; // not used by required by protocol constexpr int MIN_TRACKER_REQUESTS_INTERVAL = 15000; // in milliseconds constexpr size_t PEER_CONNECTION_RECEIVE_BUFFER_SIZE = 65535;