krb5: Fix UB

This commit is contained in:
Nicolas Williams
2022-10-26 01:54:13 -05:00
parent 5b1c69b424
commit 8e9ad6eda2
6 changed files with 29 additions and 13 deletions

View File

@@ -328,7 +328,8 @@ krb_enc(krb5_context context,
}
if (decrypt.length != clear->length ||
memcmp(decrypt.data, clear->data, decrypt.length) != 0) {
(decrypt.length &&
memcmp(decrypt.data, clear->data, decrypt.length) != 0)) {
krb5_warnx(context, "clear text not same");
return EINVAL;
}
@@ -568,7 +569,8 @@ krb_enc_mit(krb5_context context,
return ret;
if (decrypt.length != clear->length ||
memcmp(decrypt.data, clear->data, decrypt.length) != 0) {
(decrypt.length &&
memcmp(decrypt.data, clear->data, decrypt.length) != 0)) {
krb5_warnx(context, "clear text not same");
return EINVAL;
}