Blame SOURCES/0002-Use-strdup-if-offset-are-used.patch

f441eb
From 4ba49015ca1ad98c03a209a11862f8e00d00fbd0 Mon Sep 17 00:00:00 2001
f441eb
From: Sumit Bose <sbose@redhat.com>
f441eb
Date: Wed, 24 Aug 2016 16:19:36 +0200
f441eb
Subject: [PATCH 02/23] Use strdup() if offset are used
f441eb
f441eb
Strings with an offset to the original starting point must be copied
f441eb
because otherwise they cannot be properly freed later.
f441eb
---
f441eb
 library/adenroll.c | 6 +++---
f441eb
 1 file changed, 3 insertions(+), 3 deletions(-)
f441eb
f441eb
diff --git a/library/adenroll.c b/library/adenroll.c
f441eb
index d1020e9..05885d0 100644
f441eb
--- a/library/adenroll.c
f441eb
+++ b/library/adenroll.c
f441eb
@@ -1318,9 +1318,9 @@ load_keytab_entry (krb5_context k5,
f441eb
 
f441eb
 		} else if (!enroll->host_fqdn && _adcli_str_has_prefix (name, "host/") && strchr (name, '.')) {
f441eb
 			/* Skip host/ prefix */
f441eb
-			enroll->host_fqdn = name + 5;
f441eb
-			_adcli_info ("Found host qualified name in keytab: %s", name);
f441eb
-			name = NULL;
f441eb
+			enroll->host_fqdn = strdup (name + 5);
f441eb
+			return_val_if_fail (enroll->host_fqdn != NULL, FALSE);
f441eb
+			_adcli_info ("Found host qualified name in keytab: %s", enroll->host_fqdn);
f441eb
 		}
f441eb
 	}
f441eb
 
f441eb
-- 
f441eb
2.14.4
f441eb