[PATCH v2 2/2] inetmib1: Fix the IPv4 address network order for comparisons.
Francois Gouget
fgouget at codeweavers.com
Tue Feb 15 08:32:59 CST 2022
compareUdpRow() was already performing the byte-swaps but
compareIpAddrRow() and compareIpForwardRow() need them too.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
v2: Introduce DWORD_cmp() to simplify the comparisons.
The byte order was fixed in compareUdpRow() for bug 52224:
https://bugs.winehq.org/show_bug.cgi?id=52224
There is no specific test for this but adding traces showed that
the other two comparison functions were also operating on the wrong
byte order.
---
dlls/inetmib1/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/inetmib1/main.c b/dlls/inetmib1/main.c
index bd39abb6240..819f3eea2a8 100644
--- a/dlls/inetmib1/main.c
+++ b/dlls/inetmib1/main.c
@@ -778,7 +778,7 @@ static int __cdecl DWORD_cmp(DWORD a, DWORD b)
static int __cdecl compareIpAddrRow(const void *a, const void *b)
{
const MIB_IPADDRROW *rowA = a, *rowB = b;
- return DWORD_cmp(rowA->dwAddr, rowB->dwAddr);
+ return DWORD_cmp(ntohl(rowA->dwAddr), ntohl(rowB->dwAddr));
}
static BOOL mib2IpAddrQuery(BYTE bPduType, SnmpVarBind *pVarBind,
@@ -870,7 +870,7 @@ static void oidToIpForwardRow(AsnObjectIdentifier *oid, void *dst)
static int __cdecl compareIpForwardRow(const void *a, const void *b)
{
const MIB_IPFORWARDROW *rowA = a, *rowB = b;
- return DWORD_cmp(rowA->dwForwardDest, rowB->dwForwardDest);
+ return DWORD_cmp(ntohl(rowA->dwForwardDest), ntohl(rowB->dwForwardDest));
}
static BOOL mib2IpRouteQuery(BYTE bPduType, SnmpVarBind *pVarBind,
--
2.30.2
More information about the wine-devel
mailing list