A malformed KRB-CRED message may have fewer entries in the encrypted
ticket-info list than it has in the tickets list. In each loop
iteration, check if we unexpectedly reached the end of the ticket-info
list to avoid a null dereference.
[ghudson@mit.edu: added comment; rewrote commit message]
ticket: 9211 (new)
tags: pullup
target_version: 1.22-next
goto cleanup;
info = encpart->ticket_info[i];
+ if (info == NULL) {
+ /* We unexpectedly reached the end of the encrypted ticket info. */
+ ret = KRB5KRB_AP_ERR_MODIFIED;
+ goto cleanup;
+ }
ret = krb5_copy_principal(context, info->client, &list[i]->client);
if (ret)
goto cleanup;