diff --git a/dlls/snmpapi/main.c b/dlls/snmpapi/main.c index 0e60d88e7fe..9e14a194876 100644 --- a/dlls/snmpapi/main.c +++ b/dlls/snmpapi/main.c @@ -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 (i == count) return 0; if (oid1->idLength < oid2->idLength) return -1; if (oid1->idLength > oid2->idLength) return 1; return 0; diff --git a/dlls/snmpapi/tests/util.c b/dlls/snmpapi/tests/util.c index 3d513bd9349..428040d4066 100644 --- a/dlls/snmpapi/tests/util.c +++ b/dlls/snmpapi/tests/util.c @@ -330,6 +330,11 @@ static void test_SnmpUtilOidNCmp(void) ok(ret == 1, "SnmpUtilOidNCmp failed: %d\n", ret); ret = SnmpUtilOidNCmp(&oid1, &oid2, 4); 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)