Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prevent null dereference with keyboard master key
If krb5_db_fetch_mkey() prompts for a master key and needs to
determine the kvno, check that the master entry contains any key data
before dereferencing the first element.  Reported by Joshua Schaeffer.

(cherry picked from commit 29c5045)

ticket: 8600
version_fixed: 1.15.2
  • Loading branch information
greghudson committed Sep 22, 2017
1 parent b2b06fa commit 6155067
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/kdb/kdb5.c
Expand Up @@ -1220,11 +1220,12 @@ krb5_db_fetch_mkey(krb5_context context, krb5_principal mname,
krb5_db_entry *master_entry;

rc = krb5_db_get_principal(context, mname, 0, &master_entry);
if (rc == 0) {
if (rc == 0 && master_entry->n_key_data > 0)
*kvno = (krb5_kvno) master_entry->key_data->key_data_kvno;
krb5_db_free_principal(context, master_entry);
} else
else
*kvno = 1;
if (rc == 0)
krb5_db_free_principal(context, master_entry);
}

if (!salt)
Expand Down

0 comments on commit 6155067

Please sign in to comment.