]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/controls.c
Add O_EXCL
[openldap] / libraries / libldap / controls.c
index 76c2799236133b46dc3e2dcc760936d29b8e37cf..f3af141e1ea29c73ce025ceb104139fb37d23a78 100644 (file)
@@ -38,6 +38,7 @@ ldap_int_put_controls(
        LDAPControl *const *c;
 
        assert( ld != NULL );
+       assert( LDAP_VALID(ld) );
        assert( ber != NULL );
 
        if( ctrls == NULL ) {
@@ -284,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 */
@@ -414,6 +415,7 @@ ldap_create_control(
        struct berval *bvalp;
 
        assert( requestOID != NULL );
+       assert( ber != NULL );
        assert( ctrlp != NULL );
 
        ctrl = (LDAPControl *) LDAP_MALLOC( sizeof(LDAPControl) );
@@ -452,6 +454,7 @@ int ldap_int_client_controls( LDAP *ld, LDAPControl **ctrls )
        LDAPControl *const *c;
 
        assert( ld != NULL );
+       assert( LDAP_VALID(ld) );
 
        if( ctrls == NULL ) {
                /* use default server controls */