[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#8001) Segmentation Fault in ldap_sync_*

Full_Name: Alexey Kireyev
Version: 2.4.40
OS: Ubuntu 14.04
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

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;

The attached patch file is derived from OpenLDAP Software. All of the
modifications to OpenLDAP Software represented in the following patch(es) were
developed by Alexey Kireyev alexey@kireyev.name. I have not assigned rights
and/or interest in this work to any party.
I, Alexey Kireyev, hereby place the following modifications to OpenLDAP Software
(and only these modifications) into the public domain. Hence, these
modifications may be freely used and/or redistributed for any purpose with or
without attribution and/or other notice.