From: Quanah Gibson-Mount Date: Wed, 19 Nov 2008 21:07:40 +0000 (+0000) Subject: ITS#5817 X-Git-Tag: OPENLDAP_REL_ENG_2_4_13~14 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=658c99d1fe9f41fde97a5b0deced638d107c8f0c;p=openldap ITS#5817 --- diff --git a/CHANGES b/CHANGES index eca10bea51..feb79089ea 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ OpenLDAP 2.4 Change Log OpenLDAP 2.4.13 Release (2008/11/20) Added libldap dereference control support (ITS#5768) + Fixed libldap parameter checking (ITS#5817) Fixed liblutil hex conversion (ITS#5699) Fixed liblutil returning undefined data (ITS#5748) Fixed libldap error code return (ITS#5762) diff --git a/libraries/libldap/add.c b/libraries/libldap/add.c index d993650613..1a50a7929f 100644 --- a/libraries/libldap/add.c +++ b/libraries/libldap/add.c @@ -151,9 +151,32 @@ ldap_add_ext( /* for each attribute in the entry... */ for ( i = 0; attrs[i] != NULL; i++ ) { if ( ( attrs[i]->mod_op & LDAP_MOD_BVALUES) != 0 ) { + int j; + + if ( attrs[i]->mod_bvalues == NULL ) { + ld->ld_errno = LDAP_PARAM_ERROR; + ber_free( ber, 1 ); + return ld->ld_errno; + } + + for ( j = 0; attrs[i]->mod_bvalues[ j ] != NULL; j++ ) { + if ( attrs[i]->mod_bvalues[ j ]->bv_val == NULL ) { + ld->ld_errno = LDAP_PARAM_ERROR; + ber_free( ber, 1 ); + return ld->ld_errno; + } + } + rc = ber_printf( ber, "{s[V]N}", attrs[i]->mod_type, attrs[i]->mod_bvalues ); + } else { + if ( attrs[i]->mod_values == NULL ) { + ld->ld_errno = LDAP_PARAM_ERROR; + ber_free( ber, 1 ); + return ld->ld_errno; + } + rc = ber_printf( ber, "{s[v]N}", attrs[i]->mod_type, attrs[i]->mod_values ); }