From: Stephen Seo Date: Mon, 27 Apr 2020 02:47:50 +0000 (+0900) Subject: Fix check addr endianness in a4toa6 function X-Git-Tag: 1.0~65 X-Git-Url: https://git.seodisparate.com/js/bootstrap.bundle.min.js?a=commitdiff_plain;h=445a221a5b05af8a5c7cd830a07f0c9b90dd9860;p=UDPConnection Fix check addr endianness in a4toa6 function --- diff --git a/src/UDPConnection.cpp b/src/UDPConnection.cpp index 0829ed2..b498088 100644 --- a/src/UDPConnection.cpp +++ b/src/UDPConnection.cpp @@ -3058,7 +3058,7 @@ UDPC_IPV6_ADDR_TYPE UDPC_a4toa6(uint32_t a4_be) { uint32_t a4 = ntohl(a4_be); - if(a4 == 0x7F000001) { + if(a4 == 0x0100007F) { return in6addr_loopback; } diff --git a/src/test/TestUDPC.cpp b/src/test/TestUDPC.cpp index e0e0f76..a8d1ddc 100644 --- a/src/test/TestUDPC.cpp +++ b/src/test/TestUDPC.cpp @@ -321,7 +321,7 @@ TEST(UDPC, NetworkOrderEndianness) { TEST(UDPC, a4toa6) { EXPECT_EQ(UDPC_a4toa6(0), in6addr_any); - uint32_t a4 = htonl(0x7F000001); + uint32_t a4 = htonl(0x0100007F); EXPECT_EQ(UDPC_a4toa6(a4), in6addr_loopback); UDPC_IPV6_ADDR_TYPE a6 = UDPC_strtoa("::FFFF:0102:0304");