Commit 9145b551 authored by Bernhard Übelacker's avatar Bernhard Übelacker Committed by Alexandre Julliard

inetmib1: Fix endianess issue with dwLocalAddr and dwLocalPort.

parent a9c17746
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winsock2.h"
#include "snmp.h" #include "snmp.h"
#include "iphlpapi.h" #include "iphlpapi.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -1217,7 +1218,7 @@ static void oidToUdpRow(AsnObjectIdentifier *oid, void *dst) ...@@ -1217,7 +1218,7 @@ static void oidToUdpRow(AsnObjectIdentifier *oid, void *dst)
assert(oid && oid->idLength >= 5); assert(oid && oid->idLength >= 5);
row->dwLocalAddr = oidToIpAddr(oid); 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) static int __cdecl compareUdpRow(const void *a, const void *b)
...@@ -1225,9 +1226,9 @@ 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; const MIB_UDPROW *key = a, *value = b;
int ret; int ret;
ret = key->dwLocalAddr - value->dwLocalAddr; ret = ntohl(key->dwLocalAddr) - ntohl(value->dwLocalAddr);
if (ret == 0) if (ret == 0)
ret = key->dwLocalPort - value->dwLocalPort; ret = ntohs(key->dwLocalPort) - ntohs(value->dwLocalPort);
return ret; return ret;
} }
...@@ -1269,8 +1270,9 @@ static BOOL mib2UdpEntryQuery(BYTE bPduType, SnmpVarBind *pVarBind, ...@@ -1269,8 +1270,9 @@ static BOOL mib2UdpEntryQuery(BYTE bPduType, SnmpVarBind *pVarBind,
udpTable->table[tableIndex - 1].dwLocalAddr); udpTable->table[tableIndex - 1].dwLocalAddr);
if (ret) if (ret)
{ {
UINT id = ntohs(udpTable->table[tableIndex - 1].dwLocalPort);
oid.idLength = 1; oid.idLength = 1;
oid.ids = &udpTable->table[tableIndex - 1].dwLocalPort; oid.ids = &id;
ret = SnmpUtilOidAppend(&pVarBind->name, &oid); ret = SnmpUtilOidAppend(&pVarBind->name, &oid);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment