This patch fixes a possible situation when krb5_kt_close()
function is called with uninitialized keytab parameter.

https://fedorahosted.org/freeipa/ticket/712

>From b82b82a54f124ee5c881ff97cedcaf322cd2b855 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Thu, 13 Jan 2011 11:46:11 +0100
Subject: [PATCH] Unitialized pointer read in ipa-join

This patch fixes a possible situation when krb5_kt_close()
function is called with uninitialized keytab parameter.

https://fedorahosted.org/freeipa/ticket/712
---
 ipa-client/ipa-join.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipa-client/ipa-join.c b/ipa-client/ipa-join.c
index ff0fed9a4205f7840c2cb561a4f7d24e773117ed..a907c4236b0ab90db01c0af42ec137c1336e26ce 100644
--- a/ipa-client/ipa-join.c
+++ b/ipa-client/ipa-join.c
@@ -634,7 +634,7 @@ unenroll_host(const char *server, const char *hostname, const char *ktname, int
     char *realm = NULL;
 
     krb5_context krbctx = NULL;
-    krb5_keytab keytab;
+    krb5_keytab keytab = NULL;
     krb5_ccache ccache = NULL;
     krb5_principal princ = NULL;
     krb5_error_code krberr;
@@ -795,7 +795,7 @@ unenroll_host(const char *server, const char *hostname, const char *ktname, int
 
 cleanup:
 
-    krb5_kt_close(krbctx, keytab);
+    if (keytab) krb5_kt_close(krbctx, keytab);
     free((char *)principal);
     free((char *)ipaserver);
     if (princ) krb5_free_principal(krbctx, princ);
-- 
1.7.3.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to