[exim-dev] [Bug 2251] Segfault when LDAP lookup does not ret…

Góra strony
Delete this message
Reply to this message
Autor: admin
Data:  
Dla: exim-dev
Temat: [exim-dev] [Bug 2251] Segfault when LDAP lookup does not return a result
https://bugs.exim.org/show_bug.cgi?id=2251

Git Commit <git@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |git@???


--- Comment #6 from Git Commit <git@???> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/fc8cd529d7801658d38d9a4fc82a8b18fe3bbcc6

commit fc8cd529d7801658d38d9a4fc82a8b18fe3bbcc6
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Mar 11 18:46:23 2018 +0000
Commit:     Jeremy Harris <jgh146exb@???>
CommitDate: Sun Mar 11 18:53:22 2018 +0000


    Fix ldap lookups for zero-length attribute value.  Bug 2251


    Broken-by: acec9514b1
---
 doc/doc-txt/ChangeLog  |  3 +++
 src/src/lookups/ldap.c | 12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 06ed2ee..e4ad9f0 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -135,6 +135,9 @@ JH/26 Bug 2253: For logging delivery lines under PRDR,
append the overall
       the "C=" log element.  It can have useful tracking info from the
       destination system.  Patch from Simon Arlott.


+JH/27 Bug 2251: Fix ldap lookups that return a single attribute having zero-
+      length value.  Previously this would segfault.
+


 Exim version 4.90
 -----------------
diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c
index 2ebe734..63c0edf 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 */

--
You are receiving this mail because:
You are on the CC list for the bug.