Commit 960a1a9a authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

inetmib1: Copy an IP net row's physical address using a type-specific helper…

inetmib1: Copy an IP net row's physical address using a type-specific helper function, rather than using a generic helper function which made an invalid alignment assumption.
parent 950202a5
...@@ -50,14 +50,6 @@ static void setStringValue(AsnAny *value, BYTE type, DWORD len, BYTE *str) ...@@ -50,14 +50,6 @@ static void setStringValue(AsnAny *value, BYTE type, DWORD len, BYTE *str)
SnmpUtilAsnAnyCpy(value, &strValue); SnmpUtilAsnAnyCpy(value, &strValue);
} }
static DWORD copyLengthPrecededString(AsnAny *value, void *src)
{
DWORD len = *(DWORD *)src;
setStringValue(value, ASN_OCTETSTRING, len, (BYTE *)src + sizeof(DWORD));
return SNMP_ERRORSTATUS_NOERROR;
}
typedef DWORD (*copyValueFunc)(AsnAny *value, void *src); typedef DWORD (*copyValueFunc)(AsnAny *value, void *src);
struct structToAsnValue struct structToAsnValue
...@@ -919,9 +911,18 @@ static BOOL mib2IpRouteQuery(BYTE bPduType, SnmpVarBind *pVarBind, ...@@ -919,9 +911,18 @@ static BOOL mib2IpRouteQuery(BYTE bPduType, SnmpVarBind *pVarBind,
static UINT mib2IpNet[] = { 1,3,6,1,2,1,4,22,1 }; static UINT mib2IpNet[] = { 1,3,6,1,2,1,4,22,1 };
static PMIB_IPNETTABLE ipNetTable; static PMIB_IPNETTABLE ipNetTable;
static DWORD copyIpNetPhysAddr(AsnAny *value, void *src)
{
PMIB_IPNETROW row = (PMIB_IPNETROW)((BYTE *)src - FIELD_OFFSET(MIB_IPNETROW,
dwPhysAddrLen));
setStringValue(value, ASN_OCTETSTRING, row->dwPhysAddrLen, row->bPhysAddr);
return SNMP_ERRORSTATUS_NOERROR;
}
static struct structToAsnValue mib2IpNetMap[] = { static struct structToAsnValue mib2IpNetMap[] = {
{ FIELD_OFFSET(MIB_IPNETROW, dwIndex), copyInt }, { FIELD_OFFSET(MIB_IPNETROW, dwIndex), copyInt },
{ FIELD_OFFSET(MIB_IPNETROW, dwPhysAddrLen), copyLengthPrecededString }, { FIELD_OFFSET(MIB_IPNETROW, dwPhysAddrLen), copyIpNetPhysAddr },
{ FIELD_OFFSET(MIB_IPNETROW, dwAddr), copyIpAddr }, { FIELD_OFFSET(MIB_IPNETROW, dwAddr), copyIpAddr },
{ FIELD_OFFSET(MIB_IPNETROW, dwType), copyInt }, { FIELD_OFFSET(MIB_IPNETROW, dwType), copyInt },
}; };
......
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