Full_Name: Alexey Kireyev Version: 2.4.40 OS: Ubuntu 14.04 URL: ftp://ftp.openldap.org/incoming/ Submission from: (NULL) (98.118.88.65)
If not all fields in ldap_sync_t manually set after ldap_sync_initialize, then any following calls might (and most probably will) ends in segmentation fault.
Reason: ldap_sync_initialize doesn't zeroed newly allocated structure (it does it for pre-existing, though, which is wrong by itself in my view)
--------------------------------------------------------------------------------------------------------
From 01149a2eba9f463261d88e5a1ce43e19c4a323cf Mon Sep 17 00:00:00 2001
From: Alexey Kireyev <alexey@kireyev.name> Date: Wed, 10 Dec 2014 14:37:16 -0500 Subject: [PATCH] Newly allocated ldap_sync_t has to be zero out
--- libraries/libldap/ldap_sync.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libraries/libldap/ldap_sync.c b/libraries/libldap/ldap_sync.c index e573c3b..e79153f 100644 --- a/libraries/libldap/ldap_sync.c +++ b/libraries/libldap/ldap_sync.c @@ -64,11 +64,10 @@ ldap_sync_initialize( ldap_sync_t *ls_in )D%D if ( ls == NULL ) { return NULL; } - - } else { - memset( ls, 0, sizeof( ldap_sync_t ) ); }
+ memset( ls, 0, sizeof( ldap_sync_t ) ); + ls->ls_scope = LDAP_SCOPE_SUBTREE; ls->ls_timeout = -1;