File 0002-Use-strdup-if-offsets-are-used.patch of Package adcli (Revision ce46d0e7322eb68daa00b5c190e5847d)
Currently displaying revision ce46d0e7322eb68daa00b5c190e5847d , Show latest
32
1
From 0fd80844d4779a1ddcb2b920b34d458ed01ca17a Mon Sep 17 00:00:00 2001
2
From: Sumit Bose <sbose@redhat.com>
3
Date: Wed, 24 Aug 2016 16:19:36 +0200
4
Subject: [PATCH 02/25] Use strdup() if offsets are used
5
6
Strings with an offset to the original starting point must be copied
7
because otherwise they cannot be properly freed later.
8
---
9
library/adenroll.c | 6 +++---
10
1 file changed, 3 insertions(+), 3 deletions(-)
11
12
diff --git a/library/adenroll.c b/library/adenroll.c
13
index d1020e9..05885d0 100644
14
--- a/library/adenroll.c
15
+++ b/library/adenroll.c
16
17
18
} else if (!enroll->host_fqdn && _adcli_str_has_prefix (name, "host/") && strchr (name, '.')) {
19
/* Skip host/ prefix */
20
- enroll->host_fqdn = name + 5;
21
- _adcli_info ("Found host qualified name in keytab: %s", name);
22
- name = NULL;
23
+ enroll->host_fqdn = strdup (name + 5);
24
+ return_val_if_fail (enroll->host_fqdn != NULL, FALSE);
25
+ _adcli_info ("Found host qualified name in keytab: %s", enroll->host_fqdn);
26
}
27
}
28
29
--
30
2.16.4
31
32