Commit 3108e360 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

snmpapi: Test and correct SnmpUtilOidNCmp when count is less than Oid length.

parent a96e118d
...@@ -356,6 +356,7 @@ INT WINAPI SnmpUtilOidNCmp(AsnObjectIdentifier *oid1, AsnObjectIdentifier *oid2, ...@@ -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) ...@@ -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)
......
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