From dbb2ceac90c3ab45efcc6aa198fb906e15a7ab9a Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 14 Nov 2005 16:23:55 +0000 Subject: [PATCH] Fix ber_bvchr() vs assert() logic. Declare missing variable for code in #if 0. --- servers/slapd/value.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/servers/slapd/value.c b/servers/slapd/value.c index 293a4e7a35..cf2d73075e 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -271,8 +271,9 @@ ordered_value_renumber( Attribute *a, int vals ) ibv.bv_len = sprintf(ibv.bv_val, "{%d}", i); vtmp = a->a_vals[i]; if ( vtmp.bv_val[0] == '{' ) { - ptr = ber_bvchr(&vtmp, '}') + 1; + ptr = ber_bvchr(&vtmp, '}'); assert( ptr != NULL ); + ++ptr; vtmp.bv_len -= ptr - vtmp.bv_val; vtmp.bv_val = ptr; } @@ -287,8 +288,9 @@ ordered_value_renumber( Attribute *a, int vals ) if ( a->a_nvals && a->a_nvals != a->a_vals ) { vtmp = a->a_nvals[i]; if ( vtmp.bv_val[0] == '{' ) { - ptr = ber_bvchr(&vtmp, '}') + 1; + ptr = ber_bvchr(&vtmp, '}'); assert( ptr != NULL ); + ++ptr; vtmp.bv_len -= ptr - vtmp.bv_val; vtmp.bv_val = ptr; } @@ -347,7 +349,7 @@ ordered_value_sort( Attribute *a, int do_renumber ) a->a_nvals = ch_malloc( (vals+1)*sizeof(struct berval)); BER_BVZERO(a->a_nvals+vals); for ( i=0; ia_vals[i], '}') + 1; + char *ptr = ber_bvchr(&a->a_vals[i], '}') + 1; a->a_nvals[i].bv_len = a->a_vals[i].bv_len - (ptr - a->a_vals[i].bv_val); a->a_nvals[i].bv_val = ch_malloc( a->a_nvals[i].bv_len + 1); @@ -355,7 +357,7 @@ ordered_value_sort( Attribute *a, int do_renumber ) } } else { for ( i=0; ia_nvals[i], '}') + 1; + char *ptr = ber_bvchr(&a->a_nvals[i], '}') + 1; a->a_nvals[i].bv_len -= ptr - a->a_nvals[i].bv_val; strcpy(a->a_nvals[i].bv_val, ptr); } -- 2.39.5