svn rev #22369: trunk/src/kdc/

ghudson@MIT.EDU ghudson at MIT.EDU
Sun May 24 11:53:51 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22369
Commit By: ghudson
Log Message:
ticket: 6496
subject: Fix vector initialization error in KDC preauth code
target_version: 1.7
tags: pullup

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.



Changed Files:
U   trunk/src/kdc/kdc_preauth.c
Modified: trunk/src/kdc/kdc_preauth.c
===================================================================
--- trunk/src/kdc/kdc_preauth.c	2009-05-24 00:48:31 UTC (rev 22368)
+++ trunk/src/kdc/kdc_preauth.c	2009-05-24 15:53:51 UTC (rev 22369)
@@ -972,11 +972,10 @@
     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++) {




More information about the cvs-krb5 mailing list