Issue 8674 - Leak in ldap_create_assertion_control
Summary: Leak in ldap_create_assertion_control
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.40
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-14 22:00 UTC by matt.johnson@hpe.com
Modified: 2019-07-24 19:00 UTC (History)
0 users

See Also:


Attachments
0001-Fixing-8674-Leak-in-ldap_create_assertion_control.patch (871 bytes, patch)
2017-09-07 15:42 UTC, come@opensides.be
Details

Note You need to log in before you can comment on or make changes to this issue.
Description matt.johnson@hpe.com 2017-06-14 22:00:37 UTC
Full_Name: Matt Johnson
Version: 2.4.40
OS: RedHat 7.2 (Maipo)
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (15.203.233.86)


The LDAPClient::modify logic has a leak within the
    ldap_create_assertion_control method.  The leaky code occurs when the
    existing ld_errno is anything but 0 when
    the method is invoked.  Not only that, but your assertion
    returned is NULL.

The workaround is to call the following before calling
ldap_create_assertion_control.

int lvErrno = 0;
ldap_set_option(myLDAPPtr, LDAP_OPT_RESULT_CODE, &lvErrno);

Comment 1 come@opensides.be 2017-09-07 15:42:15 UTC
Hello,

I encountered this bug as well while adding controls support into php-ldap (see https://github.com/php/php-src/pull/2640 - WIP)
I used the work-around but it would still be better to fix this in openldap.

Please consider merging the attached patch.
Comment 2 Quanah Gibson-Mount 2017-09-11 16:45:34 UTC
changed notes
Comment 3 Quanah Gibson-Mount 2019-06-13 18:42:33 UTC
changed notes
changed state Open to Release
moved from Incoming to Software Bugs
Comment 4 Ondřej Kuzník 2019-06-14 10:21:26 UTC
On Thu, Sep 07, 2017 at 03:42:50PM +0000, come@opensides.be wrote:
> Hello,
> 
> I encountered this bug as well while adding controls support into
> php-ldap (see https://github.com/php/php-src/pull/2640 - WIP)
> I used the work-around but it would still be better to fix this in
> openldap.

Hi Côme,
thank you for your work, your patch has been pushed to master
(2cac3ceb03530e3afe741d4a7d4d7e21059a6a97) and will also be part
(8e6d1b8b81e94f89027a120ea862bd5938e953c6) of the upcoming 2.4.48
release.

Thanks,

-- 
Ondřej Kuzník
Senior Software Engineer
Symas Corporation                       http://www.symas.com
Packaged, certified, and supported LDAP solutions powered by OpenLDAP

Comment 5 OpenLDAP project 2019-07-24 19:00:40 UTC
Fixed in master
Fixed in RE24 (2.4.48)
Comment 6 Quanah Gibson-Mount 2019-07-24 19:00:40 UTC
changed notes
changed state Release to Closed