From 1fe0a6845ce6e904d7694b938a5469dd25c7b1dd Mon Sep 17 00:00:00 2001 From: Keith Horton Date: Sun, 2 Nov 2025 13:21:29 -0800 Subject: [PATCH] Fixed comparison function for non-network address families Signed-off-by: Keith Horton --- include/wil/network.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/wil/network.h b/include/wil/network.h index c43c21558..4ca68d778 100644 --- a/include/wil/network.h +++ b/include/wil/network.h @@ -792,7 +792,8 @@ namespace network default: // if not AF_INET or AF_INET6, and families don't match // then just raw memcmp the largest field of the union (v6) - return ::memcmp(&lhs.m_sockaddr.Ipv6, &rhs.m_sockaddr.Ipv6, sizeof(SOCKADDR_IN6)) < 0; + const auto comparison{::memcmp(&lhs.m_sockaddr.Ipv6, &rhs.m_sockaddr.Ipv6, sizeof(SOCKADDR_IN6))}; + return comparison < 0 ? -1 : (comparison > 0 ? 1 : 0); } }