From c5cd40f1bcbc26bbd9d1fa54e3e91814d7e8d370 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Mon, 23 Oct 2023 17:30:59 +0200 Subject: [PATCH] [winpr,sspi] add some missing krb5 return checks --- winpr/libwinpr/sspi/Kerberos/krb5glue_mit.c | 33 ++++++++++++++++----- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/winpr/libwinpr/sspi/Kerberos/krb5glue_mit.c b/winpr/libwinpr/sspi/Kerberos/krb5glue_mit.c index 0587464a8..fabd1a29f 100644 --- a/winpr/libwinpr/sspi/Kerberos/krb5glue_mit.c +++ b/winpr/libwinpr/sspi/Kerberos/krb5glue_mit.c @@ -129,7 +129,9 @@ krb5_error_code krb5glue_get_init_creds(krb5_context ctx, krb5_principal princ, WINPR_ASSERT(ctx); - krb5_get_init_creds_opt_alloc(ctx, &gic_opt); + rv = krb5_get_init_creds_opt_alloc(ctx, &gic_opt); + if (rv) + goto cleanup; krb5_get_init_creds_opt_set_forwardable(gic_opt, 0); krb5_get_init_creds_opt_set_proxiable(gic_opt, 0); @@ -143,15 +145,32 @@ krb5_error_code krb5glue_get_init_creds(krb5_context ctx, krb5_principal princ, if (krb_settings->renewLifeTime) krb5_get_init_creds_opt_set_renew_life(gic_opt, krb_settings->renewLifeTime); if (krb_settings->withPac) - krb5_get_init_creds_opt_set_pac_request(ctx, gic_opt, TRUE); + { + rv = krb5_get_init_creds_opt_set_pac_request(ctx, gic_opt, TRUE); + if (rv) + goto cleanup; + } if (krb_settings->armorCache) - krb5_get_init_creds_opt_set_fast_ccache_name(ctx, gic_opt, krb_settings->armorCache); + { + rv = krb5_get_init_creds_opt_set_fast_ccache_name(ctx, gic_opt, + krb_settings->armorCache); + if (rv) + goto cleanup; + } if (krb_settings->pkinitX509Identity) - krb5_get_init_creds_opt_set_pa(ctx, gic_opt, "X509_user_identity", - krb_settings->pkinitX509Identity); + { + rv = krb5_get_init_creds_opt_set_pa(ctx, gic_opt, "X509_user_identity", + krb_settings->pkinitX509Identity); + if (rv) + goto cleanup; + } if (krb_settings->pkinitX509Anchors) - krb5_get_init_creds_opt_set_pa(ctx, gic_opt, "X509_anchors", - krb_settings->pkinitX509Anchors); + { + rv = krb5_get_init_creds_opt_set_pa(ctx, gic_opt, "X509_anchors", + krb_settings->pkinitX509Anchors); + if (rv) + goto cleanup; + } if (krb_settings->kdcUrl) { const char* names[4] = { 0 };