summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-03-11 18:46:23 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2018-03-11 18:53:22 +0000
commitfc8cd529d7801658d38d9a4fc82a8b18fe3bbcc6 (patch)
treee1b56c81f35457c8d2ab9031e068e5e75a6aac74 /src
parentd9cb3c4537f82c8663c19c391bd727235916db6c (diff)
Fix ldap lookups for zero-length attribute value. Bug 2251
Broken-by: acec9514b1
Diffstat (limited to 'src')
-rw-r--r--src/src/lookups/ldap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c
index 2ebe734cd..63c0edf79 100644
--- a/src/src/lookups/ldap.c
+++ b/src/src/lookups/ldap.c
@@ -840,13 +840,13 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
result = NULL;
} /* End "while" loop for multiple results */
-/* Terminate the dynamic string that we have built and reclaim unused store */
+/* Terminate the dynamic string that we have built and reclaim unused store.
+In the odd case of a single attribute with zero-length value, allocate
+an empty string. */
-if (data)
- {
- (void) string_from_gstring(data);
- gstring_reset_unused(data);
- }
+if (!data) data = string_get(1);
+(void) string_from_gstring(data);
+gstring_reset_unused(data);
/* Copy the last dn into eldap_dn */