diff options
author | Greg Hudson <ghudson@mit.edu> | 2009-05-24 15:53:51 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2009-05-24 15:53:51 +0000 |
commit | 704e18e821c217c65f3c1ae2103d7d5e9b9e78f7 (patch) | |
tree | 1b08bace2f1ef2b4cd2a9df426839b5c3a67e235 /src | |
parent | 2c9b64dec8198a2914b75e678c6f664712d68bac (diff) | |
download | krb5-704e18e821c217c65f3c1ae2103d7d5e9b9e78f7.tar.gz krb5-704e18e821c217c65f3c1ae2103d7d5e9b9e78f7.tar.xz krb5-704e18e821c217c65f3c1ae2103d7d5e9b9e78f7.zip |
Fix vector initialization error in KDC preauth code
In the KDC, get_preauth_hint_list had two bugs initializing the
preauth array. It was allocating 21 extra entries instead of two due
to a typo (harmless), and it was only zeroing up through one extra
entry (harmful). Adjust the code to use calloc to avoid further
disagreements of this nature.
ticket: 6496
target_version: 1.7
tags: pullup
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22369 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/kdc/kdc_preauth.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/kdc/kdc_preauth.c b/src/kdc/kdc_preauth.c index 63f768756..cc7ae34ed 100644 --- a/src/kdc/kdc_preauth.c +++ b/src/kdc/kdc_preauth.c @@ -972,11 +972,10 @@ void get_preauth_hint_list(krb5_kdc_req *request, krb5_db_entry *client, e_data->data = 0; hw_only = isflagset(client->attributes, KRB5_KDB_REQUIRES_HW_AUTH); - /* Allocate 1 entry for the terminator and one for the cookie*/ - pa_data = malloc(sizeof(krb5_pa_data *) * (n_preauth_systems+21)); + /* Allocate two extra entries for the cookie and the terminator. */ + pa_data = calloc(n_preauth_systems + 2, sizeof(krb5_pa_data *)); if (pa_data == 0) return; - memset(pa_data, 0, sizeof(krb5_pa_data *) * (n_preauth_systems+1)); pa = pa_data; for (ap = preauth_systems; ap->type != -1; ap++) { |