1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

fixup! refactor: use C++ objects in announcer (#2474) (#2502)

fix Jan 22 regression in parsing port numbers from pex
This commit is contained in:
Charles Kerr 2022-01-24 20:21:35 -06:00 committed by GitHub
parent ac823f3cc4
commit 81066aae25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1209,8 +1209,10 @@ std::vector<tr_pex> tr_peerMgrCompactToPex(void const* compact, size_t compactLe
for (size_t i = 0; i < n; ++i)
{
pex[i].addr.type = TR_AF_INET;
walk = std::copy_n(walk, 4, reinterpret_cast<std::byte*>(&pex[i].addr.addr));
walk = std::copy_n(walk, 2, reinterpret_cast<std::byte*>(&pex[i].port));
std::copy_n(walk, 4, reinterpret_cast<std::byte*>(&pex[i].addr.addr));
walk += 4;
std::copy_n(walk, 2, reinterpret_cast<std::byte*>(&pex[i].port));
walk += 2;
if (added_f != nullptr && n == added_f_len)
{
@ -1259,8 +1261,10 @@ std::vector<tr_pex> tr_peerMgrCompact6ToPex(void const* compact, size_t compactL
for (size_t i = 0; i < n; ++i)
{
pex[i].addr.type = TR_AF_INET6;
walk = std::copy_n(walk, 16, reinterpret_cast<std::byte*>(&pex[i].addr.addr.addr6.s6_addr));
walk = std::copy_n(walk, 2, reinterpret_cast<std::byte*>(&pex[i].port));
std::copy_n(walk, 16, reinterpret_cast<std::byte*>(&pex[i].addr.addr.addr6.s6_addr));
walk += 16;
std::copy_n(walk, 2, reinterpret_cast<std::byte*>(&pex[i].port));
walk += 2;
if (added_f != nullptr && n == added_f_len)
{