snmpapi: Test and correct SnmpUtilOidNCmp when count is less than Oid length.
This commit is contained in:
parent
a96e118ddb
commit
3108e3605c
|
@ -356,6 +356,7 @@ INT WINAPI SnmpUtilOidNCmp(AsnObjectIdentifier *oid1, AsnObjectIdentifier *oid2,
|
||||||
if (oid1->ids[i] > oid2->ids[i]) return 1;
|
if (oid1->ids[i] > oid2->ids[i]) return 1;
|
||||||
if (oid1->ids[i] < oid2->ids[i]) return -1;
|
if (oid1->ids[i] < oid2->ids[i]) return -1;
|
||||||
}
|
}
|
||||||
|
if (i == count) return 0;
|
||||||
if (oid1->idLength < oid2->idLength) return -1;
|
if (oid1->idLength < oid2->idLength) return -1;
|
||||||
if (oid1->idLength > oid2->idLength) return 1;
|
if (oid1->idLength > oid2->idLength) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -330,6 +330,11 @@ static void test_SnmpUtilOidNCmp(void)
|
||||||
ok(ret == 1, "SnmpUtilOidNCmp failed: %d\n", ret);
|
ok(ret == 1, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
ret = SnmpUtilOidNCmp(&oid1, &oid2, 4);
|
ret = SnmpUtilOidNCmp(&oid1, &oid2, 4);
|
||||||
ok(ret == -1, "SnmpUtilOidNCmp failed: %d\n", ret);
|
ok(ret == -1, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
|
|
||||||
|
ret = SnmpUtilOidNCmp(&oid1, &oid2, 2);
|
||||||
|
ok(!ret, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
|
ret = SnmpUtilOidNCmp(&oid2, &oid1, 2);
|
||||||
|
ok(!ret, "SnmpUtilOidNCmp failed: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_SnmpUtilOidCmp(void)
|
static void test_SnmpUtilOidCmp(void)
|
||||||
|
|
Loading…
Reference in New Issue