From: Kurt Zeilenga Date: Fri, 21 Jun 2002 19:14:37 +0000 (+0000) Subject: ITS#1898: ldap_controls_dup() writes beyond allocated memory X-Git-Tag: NO_SLAP_OP_BLOCKS~1399 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cdce8064e56da78a34baaa54b01f1e8e39d8f00e;p=openldap ITS#1898: ldap_controls_dup() writes beyond allocated memory patch suggested by Dave Steck --- diff --git a/libraries/libldap/controls.c b/libraries/libldap/controls.c index 12f455be98..f3af141e1e 100644 --- a/libraries/libldap/controls.c +++ b/libraries/libldap/controls.c @@ -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 */