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:
@@ -47,7 +47,7 @@ gss_compare_name(OM_uint32 *minor_status,
|
|||||||
if (!gss_oid_equal(&name1->gn_type, &name2->gn_type)) {
|
if (!gss_oid_equal(&name1->gn_type, &name2->gn_type)) {
|
||||||
*name_equal = 0;
|
*name_equal = 0;
|
||||||
} else if (name1->gn_value.length != name2->gn_value.length ||
|
} 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)) {
|
name1->gn_value.length)) {
|
||||||
*name_equal = 0;
|
*name_equal = 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user