fix: crash on large udp announce response (#4022)

Fixes #4006.
This commit is contained in:
Charles Kerr 2022-10-24 17:58:19 -05:00 committed by GitHub
parent e8079835d3
commit 088e146cee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -225,10 +225,8 @@ struct tau_announce_request
response.leechers = buf.toUint32();
response.seeders = buf.toUint32();
auto const compact_len = std::size(buf);
auto contiguous = std::array<uint8_t, 576>{};
buf.toBuf(std::data(contiguous), compact_len);
response.pex = tr_pex::fromCompact4(std::data(contiguous), compact_len, nullptr, 0);
auto const contiguous = std::vector<std::byte>{ std::begin(buf), std::end(buf) };
response.pex = tr_pex::fromCompact4(std::data(contiguous), std::size(contiguous), nullptr, 0);
requestFinished();
}
else