make sure there are splace for storing ETYPE_NULL att the end of the array

This commit is contained in:
Love Hornquist Astrand
2009-09-20 21:57:20 -07:00
parent 4018b7bb84
commit b7bae0b201

View File

@@ -1473,13 +1473,13 @@ krb5_init_creds_set_keytab(krb5_context context,
goto next; goto next;
/* add enctype to supported list */ /* add enctype to supported list */
ptr = realloc(etypes, sizeof(etypes[0]) * (netypes + 1)); ptr = realloc(etypes, sizeof(etypes[0]) * (netypes + 2));
if (ptr == NULL) if (ptr == NULL)
goto next; goto next;
etypes = ptr; etypes = ptr;
etypes[netypes] = entry.keyblock.keytype; etypes[netypes] = entry.keyblock.keytype;
etypes[netypes + 1] = 0; etypes[netypes + 1] = ETYPE_NULL;
netypes++; netypes++;
next: next:
krb5_kt_free_entry(context, &entry); krb5_kt_free_entry(context, &entry);