mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-30 19:49:35 -05:00
Use ber_dupbv() to avoid crashing on binary values
This commit is contained in:
parent
265261bf60
commit
5b4b062dba
1 changed files with 2 additions and 11 deletions
|
|
@ -509,9 +509,7 @@ slapi_attr_get_values(
|
|||
|
||||
bv = (struct berval **)ch_malloc( (i + 1) * sizeof(struct berval *) );
|
||||
for ( j = 0; j < i; j++ ) {
|
||||
bv[j] = (struct berval *)ch_malloc( sizeof(struct berval) );
|
||||
bv[j]->bv_val = ch_strdup( attr->a_vals[j].bv_val );
|
||||
bv[j]->bv_len = attr->a_vals[j].bv_len;
|
||||
bv[j] = ber_dupbv( NULL, &attr->a_vals[j] );
|
||||
}
|
||||
bv[j] = NULL;
|
||||
|
||||
|
|
@ -1107,18 +1105,11 @@ slapi_filter_get_ava(
|
|||
goto done;
|
||||
}
|
||||
|
||||
*bval = (struct berval *)slapi_ch_malloc( sizeof(struct berval) );
|
||||
*bval = ber_dupbv( NULL, &f->f_un.f_un_ava->aa_value );
|
||||
if ( *bval == NULL ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
|
||||
(*bval)->bv_len = f->f_un.f_un_ava->aa_value.bv_len;
|
||||
(*bval)->bv_val = slapi_ch_strdup( f->f_un.f_un_ava->aa_value.bv_val );
|
||||
if ( (*bval)->bv_val == NULL ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
goto done;
|
||||
}
|
||||
} else { /* filter type not supported */
|
||||
rc = -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue