From: Luke Howard Date: Wed, 22 Jan 2003 14:53:03 +0000 (+0000) Subject: Use ber_dupbv() to avoid crashing on binary values X-Git-Tag: NO_SLAP_OP_BLOCKS~541 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b4b062dba129d3fb75d8390f1b6c26e4b603d8f;p=openldap Use ber_dupbv() to avoid crashing on binary values --- diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index f61d8b38a4..47095742a2 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -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; }