Subject: libldap-2.4-2: ldap_parse_page_control() allocates wrong amount of 
memory
Package: libldap-2.4-2
Version: 2.4.7-4
Severity: important
Tags: patch

I was in the process of trying to get rid of LDAP_DEPRECATED when I ran
into the following. In the ldap_parse_page_control() function in
libraries/libldap/pagectrl.c the wrong amount of memory is allocated for
the returned cookie.

Attached is a patch that should point out and fix the issue. I have
tested with valgrind to confirm that this is a problem (wth the patch
applied the errors reported by valgrind disappear).

Btw. Is there any usable documentation available for using the OpenLDAP
library apart from reading through the source code? I'm trying to get my
code (nss-ldapd) to work without LDAP_DEPRECATED and it is taking a lot
of time.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages libldap-2.4-2 depends on:
ii  libc6                 2.7-6              GNU C Library: Shared libraries
ii  libgnutls13           2.0.4-1            the GNU TLS library - runtime libr
ii  libsasl2-2            2.1.22.dfsg1-17+b1 Cyrus SASL - authentication abstra

libldap-2.4-2 recommends no packages.

-- no debconf information

-- 
-- arthur - [EMAIL PROTECTED] - http://people.debian.org/~adejong --
--- libraries/libldap/pagectrl.c.orig	2008-02-09 11:00:42.000000000 +0100
+++ libraries/libldap/pagectrl.c	2008-02-09 11:01:48.000000000 +0100
@@ -256,7 +256,7 @@
 
 	ld->ld_errno = ldap_parse_pageresponse_control( ld, c, countp, &cookie );
 	if ( ld->ld_errno == LDAP_SUCCESS ) {
-		*cookiep = LDAP_MALLOC( sizeof( struct berval * ) );
+		*cookiep = LDAP_MALLOC( sizeof( struct berval ) );
 		if ( *cookiep == NULL ) {
 			ld->ld_errno = LDAP_NO_MEMORY;
 		} else {

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to