From ffa095153a4aeb4b3bffe2aa5a4744fc80e5d182 Mon Sep 17 00:00:00 2001 From: Benny Baumann <BenBE@geshi.org> Date: Sun, 19 Feb 2023 21:34:54 +0100 Subject: [PATCH] fix: Proper type cast for IPv6 address conversion --- src/net/address.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/address.hpp b/src/net/address.hpp index 22998fa..39f236a 100644 --- a/src/net/address.hpp +++ b/src/net/address.hpp @@ -310,8 +310,8 @@ static constexpr void inet6_array_to_saddr(std::array<uint16_t, 8> const &ip6_co for (size_t i = 0; i < ip6_comps.size(); i++) { uint16_t hexlet = ip6_comps[i]; - in6.s6_addr[i * 2] = hexlet >> 8; - in6.s6_addr[i * 2 + 1] = hexlet & 0xff; + in6.s6_addr[i * 2] = static_cast<uint8_t>(hexlet >> 8); + in6.s6_addr[i * 2 + 1] = static_cast<uint8_t>(hexlet & 0xff); } } -- GitLab