lib/gssapi/mech/gss_compare_name.c: fix memcmp() call

Make memcmp() compare the name1 and name2 value instead of comparing
name1 with itself.

The memcmp() is only executed if the left-hand side of the || is false
i.e. when both length are equal so the length argument is correct (no out-of-bounds reads).
This commit is contained in:
aaptel
2016-03-10 10:51:58 +01:00
parent 8a950e93ae
commit c868b6ac0b

View File

@@ -47,7 +47,7 @@ gss_compare_name(OM_uint32 *minor_status,
if (!gss_oid_equal(&name1->gn_type, &name2->gn_type)) {
*name_equal = 0;
} else if (name1->gn_value.length != name2->gn_value.length ||
memcmp(name1->gn_value.value, name1->gn_value.value,
memcmp(name1->gn_value.value, name2->gn_value.value,
name1->gn_value.length)) {
*name_equal = 0;
}