If krb5_encrypt_keyhelper() returns an error, the ciphertext structure
may contain a non-zero length, but it will already have freed the
pointer to its data, making encrypt_credencpart()'s subsequent attempt
to clear and free the memory fail. Remove that logic.
Based on a patch from Jatin Nansi.
(cherry picked from commit
476284de8dc9a52b5544445cb1b316a417ae88f0)
ticket: 7948
version_fixed: 1.12.2
status: resolved
KRB5_KEYUSAGE_KRB_CRED_ENCPART, scratch,
pencdata);
- if (retval) {
- memset(pencdata->ciphertext.data, 0, pencdata->ciphertext.length);
- free(pencdata->ciphertext.data);
- pencdata->ciphertext.length = 0;
- pencdata->ciphertext.data = 0;
- }
-
memset(scratch->data, 0, scratch->length);
krb5_free_data(context, scratch);