[SSSD] [PATCH] Always initialize the returned data in sss_krb5_princ_realm()

Sumit Bose sbose at redhat.com
Thu Mar 22 11:40:44 UTC 2012


Hi,

the callers of sss_krb5_princ_realm() expect that realm and len will be
initialized. The attached patch tries to make sure that this is the case
even if krb5_principal_get_realm() is not available and
krb5_princ_realm() returns NULL.

bye,
Sumit
-------------- next part --------------
From fe6f0807a36f369d3a5b892176e2892b4069e366 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose at redhat.com>
Date: Thu, 22 Mar 2012 12:30:44 +0100
Subject: [PATCH] Always initialize the returned data in
 sss_krb5_princ_realm()

---
 src/util/sss_krb5.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/util/sss_krb5.c b/src/util/sss_krb5.c
index 0031d24..75ce2a5 100644
--- a/src/util/sss_krb5.c
+++ b/src/util/sss_krb5.c
@@ -951,6 +951,9 @@ void sss_krb5_princ_realm(krb5_context context, krb5_const_principal princ,
     if (data) {
         *realm = data->data;
         *len = data->length;
+    } else {
+        *realm = NULL;
+        *len = 0;
     }
 }
 #endif
-- 
1.7.7.6



More information about the sssd-devel mailing list