diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index f6057cae..bbe62edc 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -168,7 +168,7 @@ namespace torrents { auto b64torrent = arguments.at ("metainfo").as_string (); std::string torrentFileContent; - torrentFileContent.resize (boost::beast::detail::base64::decoded_size (b64torrent.size ())); + torrentFileContent.resize (boost::beast::detail::base64::decoded_size (b64torrent.size ()) + (b64torrent.size () % 4) * 3 / 4); // bug #3115 in boost::beast, TODO: shouls be fixed in boost >= 1.93 boost::beast::detail::base64::decode (torrentFileContent.data (), b64torrent.data (), b64torrent.size ()); std::tie (torrent, id) = m_Tunnel->AddTorrent (torrentFileContent); }