Blame SOURCES/0001-library-add-missing-strdup.patch

ee8dc1
From a64cce9830c2e9c26e120f671b247ee71b45c888 Mon Sep 17 00:00:00 2001
ee8dc1
From: Sumit Bose <sbose@redhat.com>
ee8dc1
Date: Fri, 12 Apr 2019 17:31:41 +0200
ee8dc1
Subject: [PATCH] library: add missing strdup
ee8dc1
ee8dc1
In add_server_side_service_principals _adcli_strv_add_unique is called
ee8dc1
which only adds a string to a list without copying to. Since the
ee8dc1
original list will be freed later the value must be copied.
ee8dc1
ee8dc1
This issue was introduce with 972f1a2f35829ed89f5353bd204683aa9ad6a2d2
ee8dc1
and hence
ee8dc1
ee8dc1
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1630187
ee8dc1
---
ee8dc1
 library/adenroll.c | 3 ++-
ee8dc1
 1 file changed, 2 insertions(+), 1 deletion(-)
ee8dc1
ee8dc1
diff --git a/library/adenroll.c b/library/adenroll.c
ee8dc1
index 1cce86a..52aa8a8 100644
ee8dc1
--- a/library/adenroll.c
ee8dc1
+++ b/library/adenroll.c
ee8dc1
@@ -1987,7 +1987,8 @@ add_server_side_service_principals (adcli_enroll *enroll)
ee8dc1
 		_adcli_info ("Checking %s", spn_list[c]);
ee8dc1
 		if (!_adcli_strv_has_ex (enroll->service_principals_to_remove, spn_list[c], strcasecmp)) {
ee8dc1
 			enroll->service_principals = _adcli_strv_add_unique (enroll->service_principals,
ee8dc1
-		                                                             spn_list[c], &length, false);
ee8dc1
+			                                                     strdup (spn_list[c]),
ee8dc1
+			                                                     &length, false);
ee8dc1
 			assert (enroll->service_principals != NULL);
ee8dc1
 			_adcli_info ("   Added %s", spn_list[c]);
ee8dc1
 		}
ee8dc1
-- 
ee8dc1
2.20.1
ee8dc1