[PATCH] inetmib1: Fix endianess issue with dwLocalAddr and dwLocalPort.
Bernhard Übelacker
bernhardu at mailbox.org
Thu Dec 16 04:27:19 CST 2021
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52224
Signed-off-by: Bernhard Übelacker <bernhardu at mailbox.org>
---
dlls/inetmib1/main.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/inetmib1/main.c b/dlls/inetmib1/main.c
index 6345573350e..c484e5390c4 100644
--- a/dlls/inetmib1/main.c
+++ b/dlls/inetmib1/main.c
@@ -27,6 +27,7 @@
#include "winbase.h"
#include "snmp.h"
#include "iphlpapi.h"
+#include "winternl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(inetmib1);
@@ -1217,7 +1218,7 @@ static void oidToUdpRow(AsnObjectIdentifier *oid, void *dst)
assert(oid && oid->idLength >= 5);
row->dwLocalAddr = oidToIpAddr(oid);
- row->dwLocalPort = oid->ids[4];
+ row->dwLocalPort = RtlUshortByteSwap(oid->ids[4]);
}
static int __cdecl compareUdpRow(const void *a, const void *b)
@@ -1225,9 +1226,9 @@ static int __cdecl compareUdpRow(const void *a, const void *b)
const MIB_UDPROW *key = a, *value = b;
int ret;
- ret = key->dwLocalAddr - value->dwLocalAddr;
+ ret = RtlUlongByteSwap(key->dwLocalAddr) - RtlUlongByteSwap(value->dwLocalAddr);
if (ret == 0)
- ret = key->dwLocalPort - value->dwLocalPort;
+ ret = RtlUshortByteSwap(key->dwLocalPort) - RtlUshortByteSwap(value->dwLocalPort);
return ret;
}
@@ -1269,8 +1270,10 @@ static BOOL mib2UdpEntryQuery(BYTE bPduType, SnmpVarBind *pVarBind,
udpTable->table[tableIndex - 1].dwLocalAddr);
if (ret)
{
+ UINT id;
oid.idLength = 1;
- oid.ids = &udpTable->table[tableIndex - 1].dwLocalPort;
+ id = RtlUshortByteSwap(udpTable->table[tableIndex - 1].dwLocalPort);
+ oid.ids = &id;
ret = SnmpUtilOidAppend(&pVarBind->name, &oid);
}
}
--
2.34.1
More information about the wine-devel
mailing list