]> git.sur5r.net Git - openldap/commitdiff
ITS#1898: ldap_controls_dup() writes beyond allocated memory
authorKurt Zeilenga <kurt@openldap.org>
Fri, 21 Jun 2002 19:14:37 +0000 (19:14 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 21 Jun 2002 19:14:37 +0000 (19:14 +0000)
patch suggested by Dave Steck <dsteck@novell.com>

libraries/libldap/controls.c

index 12f455be9863cc1e9fc97ef205d6a2b14abc3bd5..f3af141e1ea29c73ce025ceb104139fb37d23a78 100644 (file)
@@ -285,7 +285,7 @@ ldap_controls_dup( LDAPControl *const *controls )
                return NULL;
        }
 
-       new = (LDAPControl **) LDAP_MALLOC( i * sizeof(LDAPControl *) );
+       new = (LDAPControl **) LDAP_MALLOC( (i+1) * sizeof(LDAPControl *) );
 
        if( new == NULL ) {
                /* memory allocation failure */