From 6e7f818d153c32c119dc59d18045767426377b68 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 13 Jan 2024 21:41:27 +0100 Subject: [PATCH] minor fixes --- src/torrent_peer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/torrent_peer.cpp b/src/torrent_peer.cpp index 9bf75e4a0e4..5cf72763025 100644 --- a/src/torrent_peer.cpp +++ b/src/torrent_peer.cpp @@ -85,10 +85,12 @@ namespace libtorrent { { if (e1.port() > e2.port()) swap(e1, e2); - std::uint32_t p; - auto ptr = reinterpret_cast(&p); + std::array buf; + auto ptr = buf.data(); aux::write_uint16(e1.port(), ptr); aux::write_uint16(e2.port(), ptr); + std::uint32_t p; + std::memcpy(&p, buf.data(), 4); ret = crc32c_32(p); } else if (aux::is_v6(e1))