krb5 commit: Avoid another null dereference in krb5_rd_cred()
[email protected] Thu, 11 Jun 2026 17:07:09 -0400 (EDT)
| Newsgroups | gmane.comp.encryption.kerberos.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/krb5/krb5/commit/5031b854ad8ba6cce20cdd8c991f81dbc3f924bd commit 5031b854ad8ba6cce20cdd8c991f81dbc3f924bd Author: Rahul Hoysala <[email protected]> Date: Thu Jun 4 13:14:45 2026 +0530 Avoid another null dereference in krb5_rd_cred() In RFC 4120, the ticket client and server principal names are optional in KrbCredInfo, but we have always required them to be present. Add checks to prevent null dereferences in krb5_rd_cred() if either name is not specified. [[email protected]: folded check in with the end-of-list check; rewrote comment and commit message] ticket: 9219 (new) tags: pullup target_version: 1.22-next src/lib/krb5/krb/rd_cred.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/krb5/krb/rd_cred.c b/src/lib/krb5/krb/rd_cred.c index c341eba15..80d49fd8b 100644 --- a/src/lib/krb5/krb/rd_cred.c +++ b/src/lib/krb5/krb/rd_cred.c @@ -98,8 +98,9 @@ make_cred_list(krb5_context context, krb5_cred *krbcred, goto cleanup; info = encpart->ticket_info[i]; - if (info == NULL) { - /* We unexpectedly reached the end of the encrypted ticket info. */ + if (info == NULL || info->client == NULL || info->server == NULL) { + /* We unexpectedly reached the end of the encrypted ticket info, + * or the ticket info is unexpectedly missing a principal name. */ ret = KRB5KRB_AP_ERR_MODIFIED; goto cleanup; }