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

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