summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2019-04-12 17:31:41 +0200
committerSumit Bose <sbose@redhat.com>2019-04-15 17:13:16 +0200
commita64cce9830c2e9c26e120f671b247ee71b45c888 (patch)
tree6a95b2e2d65f2e07c59390f122994002a8e6f6db /library
parent6fd99ff6c5dd6ef0be8d942989b1c6dcee3102d9 (diff)
library: add missing strdup
In add_server_side_service_principals _adcli_strv_add_unique is called which only adds a string to a list without copying to. Since the original list will be freed later the value must be copied. This issue was introduce with 972f1a2f35829ed89f5353bd204683aa9ad6a2d2 and hence Related to https://bugzilla.redhat.com/show_bug.cgi?id=1630187
Diffstat (limited to 'library')
-rw-r--r--library/adenroll.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/library/adenroll.c b/library/adenroll.c
index 1cce86a..52aa8a8 100644
--- a/library/adenroll.c
+++ b/library/adenroll.c
@@ -1987,7 +1987,8 @@ add_server_side_service_principals (adcli_enroll *enroll)
_adcli_info ("Checking %s", spn_list[c]);
if (!_adcli_strv_has_ex (enroll->service_principals_to_remove, spn_list[c], strcasecmp)) {
enroll->service_principals = _adcli_strv_add_unique (enroll->service_principals,
- spn_list[c], &length, false);
+ strdup (spn_list[c]),
+ &length, false);
assert (enroll->service_principals != NULL);
_adcli_info (" Added %s", spn_list[c]);
}