From 445a221a5b05af8a5c7cd830a07f0c9b90dd9860 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Mon, 27 Apr 2020 11:47:50 +0900 Subject: [PATCH] Fix check addr endianness in a4toa6 function --- src/UDPConnection.cpp | 2 +- src/test/TestUDPC.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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");