From: Howard Chu Date: Fri, 20 Feb 2009 01:48:19 +0000 (+0000) Subject: ITS#5959 just drop illegal values, keep remainder if any. fix a_numvals. X-Git-Tag: ACLCHECK_0~797 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1e4060891f8a0fdb48bf0033d1d35a149978dcd3;p=openldap ITS#5959 just drop illegal values, keep remainder if any. fix a_numvals. --- diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index 4c52831e23..b82a8429d5 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -2080,24 +2080,34 @@ remove_oc:; attr->a_nvals = ch_malloc( ( last + 1 ) * sizeof( struct berval ) ); for ( i = 0; ia_desc->ad_type->sat_equality->smr_normalize( SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX, attr->a_desc->ad_type->sat_syntax, attr->a_desc->ad_type->sat_equality, &attr->a_vals[i], &attr->a_nvals[i], NULL )) { - BER_BVZERO( &attr->a_nvals[i] ); - attr_free( attr ); - goto next_attr; + LBER_FREE( attr->a_vals[i].bv_val ); + if ( --last == i ) { + BER_BVZERO( &attr->a_vals[ i ] ); + break; + } + attr->a_vals[i] = attr->a_vals[last]; + BER_BVZERO( &attr->a_vals[last] ); + i--; } } + if ( last == 0 && attr->a_vals != &slap_dummy_bv ) { + attr_free( attr ); + goto next_attr; + } BER_BVZERO( &attr->a_nvals[i] ); } else { attr->a_nvals = attr->a_vals; } + attr->a_numvals = last; *attrp = attr; attrp = &attr->a_next; next_attr:;