Bernhard Übelacker : inetmib1: Fix endianess issue with dwLocalAddr and dwLocalPort.
Alexandre Julliard
julliard at winehq.org
Fri Dec 17 15:14:56 CST 2021
Module: wine
Branch: master
Commit: 9145b551b2ebe17c1e310790db5c09da24a1beb5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9145b551b2ebe17c1e310790db5c09da24a1beb5
Author: Bernhard Übelacker <bernhardu at mailbox.org>
Date: Thu Dec 16 11:27:19 2021 +0100
inetmib1: Fix endianess issue with dwLocalAddr and dwLocalPort.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52224
Signed-off-by: Bernhard Übelacker <bernhardu at mailbox.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/inetmib1/main.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/inetmib1/main.c b/dlls/inetmib1/main.c
index 6345573350e..31dc4d5e8e2 100644
--- a/dlls/inetmib1/main.c
+++ b/dlls/inetmib1/main.c
@@ -25,6 +25,7 @@
#include "windef.h"
#include "winbase.h"
+#include "winsock2.h"
#include "snmp.h"
#include "iphlpapi.h"
#include "wine/debug.h"
@@ -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 = htons(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 = ntohl(key->dwLocalAddr) - ntohl(value->dwLocalAddr);
if (ret == 0)
- ret = key->dwLocalPort - value->dwLocalPort;
+ ret = ntohs(key->dwLocalPort) - ntohs(value->dwLocalPort);
return ret;
}
@@ -1269,8 +1270,9 @@ static BOOL mib2UdpEntryQuery(BYTE bPduType, SnmpVarBind *pVarBind,
udpTable->table[tableIndex - 1].dwLocalAddr);
if (ret)
{
+ UINT id = ntohs(udpTable->table[tableIndex - 1].dwLocalPort);
oid.idLength = 1;
- oid.ids = &udpTable->table[tableIndex - 1].dwLocalPort;
+ oid.ids = &id;
ret = SnmpUtilOidAppend(&pVarBind->name, &oid);
}
}
More information about the wine-cvs
mailing list