From cdce8064e56da78a34baaa54b01f1e8e39d8f00e Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 21 Jun 2002 19:14:37 +0000 Subject: [PATCH] ITS#1898: ldap_controls_dup() writes beyond allocated memory patch suggested by Dave Steck --- libraries/libldap/controls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 */ -- 2.39.5