From d0e2467120a1a675fce94bcc341c4ef3b6236ce7 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 17 Jan 2022 21:57:07 -0500 Subject: [PATCH] kdc: _kdc_do_kx509 prevent use of NULL cprincipal If the return code is non-zero do not call krb5_unparse_name() as cprincipal will be NULL. Change-Id: I901b3f5dcdbc186f89257aef935b91e1d207119c --- kdc/kx509.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kdc/kx509.c b/kdc/kx509.c index 6217f5c55..5dba3c0a1 100644 --- a/kdc/kx509.c +++ b/kdc/kx509.c @@ -940,7 +940,8 @@ _kdc_do_kx509(kx509_req_context r) goto out; } - ret = krb5_unparse_name(r->context, cprincipal, &r->cname); + if (ret == 0) + ret = krb5_unparse_name(r->context, cprincipal, &r->cname); /* Check that the service name is a valid kx509 service name */ if (ret == 0)