From: Pierangelo Masarati Date: Mon, 18 Dec 2006 01:28:43 +0000 (+0000) Subject: catch invalid read (i == -1) X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~350 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bcbd40344fe3d3a387fa1c3a87375e5af6a3f6e;p=thirdparty%2Fopenldap.git catch invalid read (i == -1) --- diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 826219c4c0..3a4e6e70ae 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -901,16 +901,17 @@ int slap_mods_check( } } done: - j = ix[i]; slap_sl_free( ix, ctx ); if ( rc != LDAP_SUCCESS ) { return rc; } else if ( match == 0 ) { /* value exists already */ + assert( i >= 0 ); + assert( i < nvals ); snprintf( textbuf, textlen, "%s: value #%d provided more than once", - ml->sml_desc->ad_cname.bv_val, j ); + ml->sml_desc->ad_cname.bv_val, ix[i] ); *text = textbuf; return LDAP_TYPE_OR_VALUE_EXISTS; }