aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2015-07-03 19:34:46 -0400
committerTom Yu <tlyu@mit.edu>2015-12-09 14:54:23 -0500
commita2acda434a9b7f8285964079e4e242fea14ef164 (patch)
tree8b8a73a561f4c81e514a86fd3343c95ce87e3b71
parent30e9f9c3820a3d368fbe45c93abfc1cef7d60f4d (diff)
downloadkrb5-a2acda434a9b7f8285964079e4e242fea14ef164.zip
krb5-a2acda434a9b7f8285964079e4e242fea14ef164.tar.gz
krb5-a2acda434a9b7f8285964079e4e242fea14ef164.tar.bz2
Fix uncommon null dereference in PKINIT client
crypto_retrieve_cert_sans() is allowed to set its princs output to NULL, although the OpenSSL implementation rarely does. Fix the TRACE_PKINIT_CLIENT_SAN_KDCCERT_PRINC for loop to allow this like other parts of the function do, and also get rid of the unnecessary princptr variable by using an integer index like other parts of the function. Based on a patch from Daniel Deptula. (cherry picked from commit 47b37b9e13ca1456ba6710f31bc41012d050dd07) ticket: 8305 (new) version_fixed: 1.12.5 status: resolved
-rw-r--r--src/plugins/preauth/pkinit/pkinit_clnt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/preauth/pkinit/pkinit_clnt.c b/src/plugins/preauth/pkinit/pkinit_clnt.c
index cfef5b9..3724cef 100644
--- a/src/plugins/preauth/pkinit/pkinit_clnt.c
+++ b/src/plugins/preauth/pkinit/pkinit_clnt.c
@@ -515,7 +515,7 @@ verify_kdc_san(krb5_context context,
{
krb5_error_code retval;
char **certhosts = NULL, **cfghosts = NULL, **hostptr;
- krb5_principal *princs = NULL, *princptr;
+ krb5_principal *princs = NULL;
unsigned char ***get_dns;
int i, j;
@@ -547,8 +547,8 @@ verify_kdc_san(krb5_context context,
retval = KRB5KDC_ERR_KDC_NAME_MISMATCH;
goto out;
}
- for (princptr = princs; *princptr != NULL; princptr++)
- TRACE_PKINIT_CLIENT_SAN_KDCCERT_PRINC(context, *princptr);
+ for (i = 0; princs != NULL && princs[i] != NULL; i++)
+ TRACE_PKINIT_CLIENT_SAN_KDCCERT_PRINC(context, princs[i]);
if (certhosts != NULL) {
for (hostptr = certhosts; *hostptr != NULL; hostptr++)
TRACE_PKINIT_CLIENT_SAN_KDCCERT_DNSNAME(context, *hostptr);